Browse Source

dbus: Fix get_all_properties() to handle NULL return from getter

This needs to avoid trying to add the NULL entry into the D-Bus
message since libdbus will make the program terminate in such a case.
Jouni Malinen 15 years ago
parent
commit
21e210fc99
1 changed files with 3 additions and 0 deletions
  1. 3 0
      wpa_supplicant/dbus/dbus_new_helpers.c

+ 3 - 0
wpa_supplicant/dbus/dbus_new_helpers.c

@@ -648,6 +648,8 @@ static DBusMessage * get_all_properties(
 
 			getterReply = property_dsc->getter(
 				message, obj_dsc->user_data);
+			if (getterReply == NULL)
+				goto skip;
 			dbus_message_iter_init(getterReply, &ret_iter);
 
 			dbus_message_iter_open_container(&dict_iter,
@@ -662,6 +664,7 @@ static DBusMessage * get_all_properties(
 			dbus_message_iter_close_container(&dict_iter,
 							  &entry_iter);
 			dbus_message_unref(getterReply);
+		skip:
 			counter++;
 		}
 		property_dsc = property_dsc->next;