From c5f3198a9fdcd22a342be496b7ba6751ea1b53d2 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 22 Oct 2012 12:27:55 +0200 Subject: [PATCH] device: only export modem if it is available --- src/mm-device.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mm-device.c b/src/mm-device.c index c5491008..c28d0b5a 100644 --- a/src/mm-device.c +++ b/src/mm-device.c @@ -435,8 +435,14 @@ modem_valid (MMBaseModem *modem, /* Modem no longer valid */ mm_device_remove_modem (self); } else { - /* Modem now valid, export it */ - export_modem (self); + /* Modem now valid, export it, but only if we really have it around. + * It may happen that the initialization sequence fails because the + * modem gets disconnected, and in that case we don't really need + * to export it */ + if (self->priv->modem) + export_modem (self); + else + mm_dbg ("Not exporting modem; no longer available"); } }