libmm-glib: fix firmware list result parsing

This commit is contained in:
Aleksander Morgado
2012-10-04 18:35:57 +02:00
parent a27fd5a47b
commit 9e16aeb6bf

View File

@@ -182,7 +182,7 @@ build_results (const gchar *str_selected,
*selected = NULL; *selected = NULL;
if (!dictionaries_installed) { if (!dictionaries_installed) {
if (str_selected) { if (str_selected && str_selected[0]) {
g_set_error (error, g_set_error (error,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS, MM_CORE_ERROR_INVALID_ARGS,
@@ -201,7 +201,7 @@ build_results (const gchar *str_selected,
if (n > 0) { if (n > 0) {
GVariant *dictionary = NULL; GVariant *dictionary = NULL;
while (g_variant_iter_loop (&iter, "a{sv}", &dictionary)) { while ((dictionary = g_variant_iter_next_value (&iter))) {
MMFirmwareProperties *firmware; MMFirmwareProperties *firmware;
GError *inner_error = NULL; GError *inner_error = NULL;
@@ -217,14 +217,16 @@ build_results (const gchar *str_selected,
/* Save the firmware properties */ /* Save the firmware properties */
*installed = g_list_append (*installed, firmware); *installed = g_list_append (*installed, firmware);
if (str_selected && if (str_selected && str_selected[0] &&
g_str_equal (mm_firmware_properties_get_unique_id (firmware), str_selected)) g_str_equal (mm_firmware_properties_get_unique_id (firmware), str_selected))
*selected = g_object_ref (firmware); *selected = g_object_ref (firmware);
} }
g_variant_unref (dictionary);
} }
} }
if (str_selected && *selected == NULL) if (str_selected && str_selected[0] && *selected == NULL)
g_warning ("Selected image '%s' was not found in the list of installed images", g_warning ("Selected image '%s' was not found in the list of installed images",
str_selected); str_selected);