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.
This commit is contained in:
Jouni Malinen 2010-01-01 12:27:10 +02:00
parent fcea0b7d1d
commit 21e210fc99

View file

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