diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 02:13:56 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 02:13:56 +0000 |
commit | 3ed062686e3cb3654ce101a5a2c409904e6ced8b (patch) | |
tree | 3b778eef59f969999da0631528b7ddbe6fc8cd32 /dbus/message.cc | |
parent | 106ad14cdd25ff6574a340b7b1c8182d70973723 (diff) | |
download | chromium_src-3ed062686e3cb3654ce101a5a2c409904e6ced8b.zip chromium_src-3ed062686e3cb3654ce101a5a2c409904e6ced8b.tar.gz chromium_src-3ed062686e3cb3654ce101a5a2c409904e6ced8b.tar.bz2 |
dbus: Fix a bug where we rejected an empty array in PopArrayOfBytes()
An empty array should be allowed. Sometimes, you need to send an
empty array from methods and signals.
BUG=103793
TEST=added a test in dbus_unittests
Review URL: http://codereview.chromium.org/8525012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/message.cc')
-rw-r--r-- | dbus/message.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/dbus/message.cc b/dbus/message.cc index aa9cc55..2750cb1 100644 --- a/dbus/message.cc +++ b/dbus/message.cc @@ -755,6 +755,12 @@ bool MessageReader::PopArrayOfBytes(uint8** bytes, size_t* length) { MessageReader array_reader(message_); if (!PopArray(&array_reader)) return false; + // An empty array is allowed. + if (!array_reader.HasMoreData()) { + *length = 0; + *bytes = NULL; + return true; + } if (!array_reader.CheckDataType(DBUS_TYPE_BYTE)) return false; int int_length = 0; @@ -762,7 +768,7 @@ bool MessageReader::PopArrayOfBytes(uint8** bytes, size_t* length) { bytes, &int_length); *length = static_cast<int>(int_length); - return bytes != NULL; + return true; } bool MessageReader::PopArrayOfStrings( |