From 4b507f3255f89c9880388e73256198da5e3e2cb6 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 24 Dec 2018 15:20:08 +0100 Subject: [PATCH] ublox: fix double task completion If mm_ublox_get_supported_bands() and mm_ublox_get_support_config() both failed, we would be completing the GTask twice. Fix it by chaining both steps so that the second one is not run if the first one is already failed. --- plugins/ublox/mm-broadband-modem-ublox.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/plugins/ublox/mm-broadband-modem-ublox.c b/plugins/ublox/mm-broadband-modem-ublox.c index c6d6fa9f..466e9de3 100644 --- a/plugins/ublox/mm-broadband-modem-ublox.c +++ b/plugins/ublox/mm-broadband-modem-ublox.c @@ -117,16 +117,9 @@ load_supported_bands (MMIfaceModem *_self, task = g_task_new (_self, NULL, callback, user_data); bands = mm_ublox_get_supported_bands (model, &error); - - if (!mm_ublox_get_support_config (model, &self->priv->support_config, &error)) { - g_assert (error); + if (!bands || !mm_ublox_get_support_config (model, &self->priv->support_config, &error)) g_task_return_error (task, error); - } - - if (!bands) { - g_assert (error); - g_task_return_error (task, error); - } else + else g_task_return_pointer (task, bands, (GDestroyNotify) g_array_unref); g_object_unref (task); }