From 9e16aeb6bfc097c59e3dfc8932c21353e00f73c1 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 4 Oct 2012 18:35:57 +0200 Subject: libmm-glib: fix firmware list result parsing --- libmm-glib/mm-modem-firmware.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libmm-glib/mm-modem-firmware.c') diff --git a/libmm-glib/mm-modem-firmware.c b/libmm-glib/mm-modem-firmware.c index 96f74951..c52f3160 100644 --- a/libmm-glib/mm-modem-firmware.c +++ b/libmm-glib/mm-modem-firmware.c @@ -182,7 +182,7 @@ build_results (const gchar *str_selected, *selected = NULL; if (!dictionaries_installed) { - if (str_selected) { + if (str_selected && str_selected[0]) { g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, @@ -201,7 +201,7 @@ build_results (const gchar *str_selected, if (n > 0) { GVariant *dictionary = NULL; - while (g_variant_iter_loop (&iter, "a{sv}", &dictionary)) { + while ((dictionary = g_variant_iter_next_value (&iter))) { MMFirmwareProperties *firmware; GError *inner_error = NULL; @@ -217,14 +217,16 @@ build_results (const gchar *str_selected, /* Save the firmware properties */ *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)) *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", str_selected); -- cgit v1.2.3-70-g09d2