Fix possible nullptr issue 57/89957/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 28 Sep 2016 01:54:09 +0000 (10:54 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 28 Sep 2016 01:54:09 +0000 (10:54 +0900)
- GError will be set if GDBusConnection is null,
according to reference guide docs.
- 'or' should be change into 'and' to resolve static analysis
problem.

Change-Id: I82ece65c0b8eb74a69ca2cd540cc72860c11720d
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/pkgdir_tool_request.cc

index 20e22db..8628904 100644 (file)
@@ -20,7 +20,7 @@ bool DBusRequestForDirectoryOperation(const char* method,
     GVariant* parameter) {
   GError* err = nullptr;
   GDBusConnection* con = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &err);
-  if (!con || err) {
+  if (!con && err) {
     LOG(WARNING) << "Failed to get dbus connection: " << err->message;
     g_error_free(err);
     return false;