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.
This commit is contained in:
Aleksander Morgado
2018-12-24 15:20:08 +01:00
parent bbb96cd3f9
commit 4b507f3255

View File

@@ -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);
}