diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-18 05:48:34 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-18 05:48:34 +0000 |
commit | 4477aae3367d44c3000b312b7e4b531babf35b66 (patch) | |
tree | 19de8eaefbd9906c4499190983041848ea5638e7 /mojo/public | |
parent | cadf1413cba4d10417ea1d89b75497a9ad55eed5 (diff) | |
download | chromium_src-4477aae3367d44c3000b312b7e4b531babf35b66.zip chromium_src-4477aae3367d44c3000b312b7e4b531babf35b66.tar.gz chromium_src-4477aae3367d44c3000b312b7e4b531babf35b66.tar.bz2 |
Fix some runtime errors in mojo Connector.
R=viettrungluu
BUG=none
Review URL: https://codereview.chromium.org/74353002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/public')
-rw-r--r-- | mojo/public/bindings/lib/connector.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/mojo/public/bindings/lib/connector.cc b/mojo/public/bindings/lib/connector.cc index 3185536..5a8748d 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. |