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:
@@ -117,16 +117,9 @@ load_supported_bands (MMIfaceModem *_self,
|
|||||||
task = g_task_new (_self, NULL, callback, user_data);
|
task = g_task_new (_self, NULL, callback, user_data);
|
||||||
|
|
||||||
bands = mm_ublox_get_supported_bands (model, &error);
|
bands = mm_ublox_get_supported_bands (model, &error);
|
||||||
|
if (!bands || !mm_ublox_get_support_config (model, &self->priv->support_config, &error))
|
||||||
if (!mm_ublox_get_support_config (model, &self->priv->support_config, &error)) {
|
|
||||||
g_assert (error);
|
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
}
|
else
|
||||||
|
|
||||||
if (!bands) {
|
|
||||||
g_assert (error);
|
|
||||||
g_task_return_error (task, error);
|
|
||||||
} else
|
|
||||||
g_task_return_pointer (task, bands, (GDestroyNotify) g_array_unref);
|
g_task_return_pointer (task, bands, (GDestroyNotify) g_array_unref);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user