aboutsummaryrefslogtreecommitdiff
path: root/cli/mmcli-common.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-03-15 12:31:14 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-16 14:53:25 +0100
commit979c52038176ded90809c77ee7e97e0ddb665ebb (patch)
tree2abfdcf2f6d158761d1113f5890aaabe96209114 /cli/mmcli-common.c
parent346de780bea9ac00d2d4b0f01566755649498002 (diff)
cli: don't assume every modem exposes the Messaging interface
Diffstat (limited to 'cli/mmcli-common.c')
-rw-r--r--cli/mmcli-common.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/cli/mmcli-common.c b/cli/mmcli-common.c
index d373c1bc..db1e06ab 100644
--- a/cli/mmcli-common.c
+++ b/cli/mmcli-common.c
@@ -873,16 +873,22 @@ look_for_sms_in_modem (GetSmsContext *ctx)
/* Loop looking for the sms in each modem found */
ctx->current = MM_OBJECT (ctx->modems->data);
ctx->modems = g_list_delete_link (ctx->modems, ctx->modems);
- g_debug ("Looking for sms '%s' in modem '%s'...",
- ctx->sms_path,
- mm_object_get_path (ctx->current));
modem = mm_object_get_modem_messaging (ctx->current);
- mm_modem_messaging_list (modem,
- ctx->cancellable,
- (GAsyncReadyCallback)list_sms_ready,
- ctx);
- g_object_unref (modem);
+ if (modem) {
+ g_debug ("Looking for sms '%s' in modem '%s'...",
+ ctx->sms_path,
+ mm_object_get_path (ctx->current));
+ mm_modem_messaging_list (modem,
+ ctx->cancellable,
+ (GAsyncReadyCallback)list_sms_ready,
+ ctx);
+ g_object_unref (modem);
+ return;
+ }
+
+ /* Current modem has no messaging capabilities, try with next modem */
+ look_for_sms_in_modem (ctx);
}
static void