diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-12-31 12:56:55 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:42 +0100 |
commit | bda0d0c1d4e5bf06cd1296c140e4f03ecba6836c (patch) | |
tree | 3dc90a722279468b8784e1e059660fe2110f52d0 | |
parent | 34bf2e6dd1405cd15ff727c0401482a14cd1bdbd (diff) |
iface-modem: allow implementations to return no SIM and no error
That would mean that the implementation doesn't want to handle a SIM object
around, maybe because it doesn't support it properly, or because there is
no SIM at all (e.g. CDMA-only modems).
-rw-r--r-- | src/mm-iface-modem.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index d3c1f524..88128539 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -2485,23 +2485,25 @@ sim_new_ready (GAsyncInitable *initable, GError *error = NULL; sim = MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->create_sim_finish (ctx->self, res, &error); - if (!sim) { - /* FATAL */ - mm_warn ("couldn't create SIM: '%s'", - error ? error->message : "Unknown error"); + if (error) { + mm_warn ("couldn't create SIM: '%s'", error->message); g_simple_async_result_take_error (ctx->result, error); initialization_context_complete_and_free (ctx); return; } - g_object_bind_property (sim, MM_SIM_PATH, - ctx->skeleton, "sim", - G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); + /* We may get error with !sim, when the implementation doesn't want to + * handle any (e.g. CDMA) */ + if (sim) { + g_object_bind_property (sim, MM_SIM_PATH, + ctx->skeleton, "sim", + G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); - g_object_set (ctx->self, - MM_IFACE_MODEM_SIM, sim, - NULL); - g_object_unref (sim); + g_object_set (ctx->self, + MM_IFACE_MODEM_SIM, sim, + NULL); + g_object_unref (sim); + } /* Go on to next step */ ctx->step++; |