aboutsummaryrefslogtreecommitdiff
path: root/plugins/cinterion/mm-common-cinterion.c
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2017-07-06 15:18:18 -0700
committerAleksander Morgado <aleksander@aleksander.es>2017-07-07 10:15:07 +0200
commit344d96af44f0c2aa4b31e39fb29c3e76d17b4e4b (patch)
tree5bfd00cf95399d432e41461d8ddbf74ae11fb404 /plugins/cinterion/mm-common-cinterion.c
parentb44f1b6da07580ec1c9704125b00d7711b4dea5e (diff)
cinterion: check error returned by g_task_propagate_error instead
When returning an enum value via g_task_return_int, some code assumes the enum value is always non-negative and thus considers that a negative value implies an error. This assumption could be invalidated if a negative value is later added to the enum. To make it less error prone to future changes, this patch modifies the code to check if the GError argument to g_task_propagate_error is populated instead.
Diffstat (limited to 'plugins/cinterion/mm-common-cinterion.c')
-rw-r--r--plugins/cinterion/mm-common-cinterion.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/cinterion/mm-common-cinterion.c b/plugins/cinterion/mm-common-cinterion.c
index 3f2b3994..67bc5b3b 100644
--- a/plugins/cinterion/mm-common-cinterion.c
+++ b/plugins/cinterion/mm-common-cinterion.c
@@ -122,11 +122,14 @@ mm_common_cinterion_location_load_capabilities_finish (MMIfaceModemLocation *se
GAsyncResult *res,
GError **error)
{
+ GError *inner_error = NULL;
gssize aux;
- if ((aux = g_task_propagate_int (G_TASK (res), error)) < 0)
+ aux = g_task_propagate_int (G_TASK (res), &inner_error);
+ if (inner_error) {
+ g_propagate_error (error, inner_error);
return MM_MODEM_LOCATION_SOURCE_NONE;
-
+ }
return (MMModemLocationSource) aux;
}