[go: up one dir, main page]

Fix crash in SMSHandler in case of DBUS errors

BUG=chromium-os:15349
TEST=build

Change-Id: I46f1464d9c93cb87bfade82a89764fe7e40bc884
Tested-by: Dmitry Polukhin <dpolukhin@chromium.org>
Reviewed-by: Nathan J. Williams <njw@chromium.org>
(cherry picked from commit 3f3b37abcb3a92df15a08bd292f736d72935c54d)
Reviewed-on: http://gerrit.chromium.org/gerrit/1107
Reviewed-by: Nikita Kostylev <nkostylev@chromium.org>
Reviewed-by: Zelidrag Hornung <zelidrag@chromium.org>
diff --git a/chromeos_network.cc b/chromeos_network.cc
index 34b6dc8..bfbf2f3 100644
--- a/chromeos_network.cc
+++ b/chromeos_network.cc
@@ -2192,8 +2192,16 @@
                                        const char* path,
                                        const Value* properties) {
     DCHECK(object);
+    // Callback is called with properties == NULL in case of DBUs errors.
+    if (!object || !properties)
+      return;
+
+    if (properties->GetType() != Value::TYPE_DICTIONARY) {
+      LOG(ERROR) << "Properties type is not a dictionary.";
+      return;
+    }
+
     SMSHandler* self = static_cast<SMSHandler*>(object);
-    DCHECK_EQ(properties->GetType(), Value::TYPE_DICTIONARY);
     const DictionaryValue* dict =
         static_cast<const DictionaryValue*>(properties);