From 18b72a046e89d00d7e7b9f2d718c43d64e595de0 Mon Sep 17 00:00:00 2001 From: Frederic Martinsons Date: Sun, 20 Dec 2020 18:11:06 +0100 Subject: mmcli: don't assume that mm_object_peek_modem or mm_object_get_modem return non null This very peculiar case can happen when an intermediate initiliazition step of a modem fails. The ModemManager daemon should always expose the modem interface but let not assume that in mmcli and protect these calls. Signed-off-by: Frederic Martinsons --- cli/mmcli-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli/mmcli-common.c') diff --git a/cli/mmcli-common.c b/cli/mmcli-common.c index a5402431..4163f42f 100644 --- a/cli/mmcli-common.c +++ b/cli/mmcli-common.c @@ -205,7 +205,9 @@ find_modem (MMManager *manager, MMModem *modem; obj = MM_OBJECT (l->data); - modem = MM_MODEM (mm_object_get_modem (obj)); + modem = mm_object_get_modem (obj); + if (!modem) + continue; if (modem_any || (modem_path && g_str_equal (mm_object_get_path (obj), modem_path)) || -- cgit v1.2.3-70-g09d2