summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2012-11-27 07:56:27 (GMT)
committerAleksander Morgado <aleksander@lanedo.com>2012-11-27 10:00:35 (GMT)
commit674ecaa6eb356539a56d84057cc9fa7b5aeed0b1 (patch)
treef7c2b51b00390965d4b83f55c4e31f22b08ac014
parentcf46ed42384e9fbd4872e2f98d743755d8f9a571 (diff)
broadband-modem: check for NULL response in parse_caps_{cpin,cgmm,gcap}
-rw-r--r--src/mm-broadband-modem.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 9161c82..174de9d 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -435,10 +435,13 @@ parse_caps_gcap (MMBaseModem *self,
const ModemCaps *cap = modem_caps;
guint32 ret = 0;
+ if (!response)
+ return FALSE;
+
/* Some modems (Huawei E160g) won't respond to +GCAP with no SIM, but
* will respond to ATI. Ignore the error and continue.
*/
- if (response && strstr (response, "+CME ERROR:"))
+ if (strstr (response, "+CME ERROR:"))
return FALSE;
while (cap->name) {
@@ -465,6 +468,9 @@ parse_caps_cpin (MMBaseModem *self,
GVariant **result,
GError **result_error)
{
+ if (!response)
+ return FALSE;
+
if (strcasestr (response, "SIM PIN") ||
strcasestr (response, "SIM PUK") ||
strcasestr (response, "PH-SIM PIN") ||
@@ -498,6 +504,9 @@ parse_caps_cgmm (MMBaseModem *self,
GVariant **result,
GError **result_error)
{
+ if (!response)
+ return FALSE;
+
/* This check detects some really old Motorola GPRS dongles and phones */
if (strstr (response, "GSM900") ||
strstr (response, "GSM1800") ||