client: Read D-Bus string type only if argument is 'Type'
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 7 Jun 2013 05:25:25 +0000 (08:25 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 7 Jun 2013 07:09:18 +0000 (10:09 +0300)
A basic type was always read independent of the argument type which
on some systems lead to a crash and on others only to a warning
printout.

client/agent.c

index afd265b..16d1928 100644 (file)
@@ -386,10 +386,11 @@ static DBusMessage *agent_request_input(DBusConnection *connection,
 
                        dbus_message_iter_recurse(&field_entry, &field_value);
 
-                       dbus_message_iter_get_basic(&field_value, &value);
-
-                       if (strcmp(argument, "Type") == 0)
+                       if (strcmp(argument, "Type") == 0) {
+                               dbus_message_iter_get_basic(&field_value,
+                                               &value);
                                attr_type = g_strdup(value);
+                       }
 
                        dbus_message_iter_next(&dict_entry);
                }