aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-12-24 15:20:08 +0100
committerAleksander Morgado <aleksander@aleksander.es>2019-01-30 12:10:03 +0100
commit4b507f3255f89c9880388e73256198da5e3e2cb6 (patch)
treea2cec8f689bc6dd65d54a14312de49a885e9e27e
parentbbb96cd3f9fefc4884e0239a166d5e64423b83f4 (diff)
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.
-rw-r--r--plugins/ublox/mm-broadband-modem-ublox.c11
1 files 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);
}