Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: mojo/public/bindings/lib/connector.cc

Issue 74353002: Fix some runtime errors in mojo Connector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/lib/connector.cc
diff --git a/mojo/public/bindings/lib/connector.cc b/mojo/public/bindings/lib/connector.cc
index 31855368b5e8eba6d9828ca873e4cdb9498f26b5..5a8748da53a5ff8ecc12c24b29f66128291a4e98 100644
--- a/mojo/public/bindings/lib/connector.cc
+++ b/mojo/public/bindings/lib/connector.cc
@@ -95,7 +95,7 @@ void Connector::ReadMore() {
rv = ReadMessage(message_pipe_,
message.data,
&num_bytes,
- &message.handles[0],
+ message.handles.empty() ? NULL : &message.handles[0],
&num_handles,
MOJO_READ_MESSAGE_FLAG_NONE);
if (rv != MOJO_RESULT_OK) {
@@ -127,12 +127,13 @@ void Connector::WriteOne(Message* message, bool* wait_to_write) {
// in that case.
*wait_to_write = false;
- MojoResult rv = WriteMessage(message_pipe_,
- message->data,
- message->data->header.num_bytes,
- &message->handles[0],
- static_cast<uint32_t>(message->handles.size()),
- MOJO_WRITE_MESSAGE_FLAG_NONE);
+ MojoResult rv = WriteMessage(
+ message_pipe_,
+ message->data,
+ message->data->header.num_bytes,
+ message->handles.empty() ? NULL : &message->handles[0],
+ static_cast<uint32_t>(message->handles.size()),
+ MOJO_WRITE_MESSAGE_FLAG_NONE);
if (rv == MOJO_RESULT_OK) {
// The handles were successfully transferred, so we don't need the message
// to track their lifetime any longer.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698