Tweak CREG notification to be more fault tolerant
authorDenis Kenzior <denkenz@gmail.com>
Wed, 29 Jul 2009 16:10:57 +0000 (11:10 -0500)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 29 Jul 2009 17:26:06 +0000 (12:26 -0500)
drivers/atmodem/network-registration.c

index f30c41a..44f0846 100644 (file)
@@ -95,13 +95,18 @@ static void at_creg_cb(gboolean ok, GAtResult *result, gpointer user_data)
 
        if (g_at_result_iter_next_string(&iter, &str) == TRUE)
                lac = strtol(str, NULL, 16);
+       else
+               goto out;
 
        if (g_at_result_iter_next_string(&iter, &str) == TRUE)
                ci = strtol(str, NULL, 16);
+       else
+               goto out;
 
        if (g_at_result_iter_next_number(&iter, &tech) == TRUE)
                at->netreg->supports_tech = TRUE;
 
+out:
        ofono_debug("creg_cb: %d, %d, %d, %d", status, lac, ci, tech);
 
        cb(&error, status, lac, ci, tech, cbd->data);
@@ -601,13 +606,18 @@ static void creg_notify(GAtResult *result, gpointer user_data)
 
        if (g_at_result_iter_next_string(&iter, &str) == TRUE)
                lac = strtol(str, NULL, 16);
+       else
+               goto out;
 
        if (g_at_result_iter_next_string(&iter, &str) == TRUE)
                ci = strtol(str, NULL, 16);
+       else
+               goto out;
 
        if (g_at_result_iter_next_number(&iter, &tech) == TRUE)
                at->netreg->supports_tech = TRUE;
 
+out:
        ofono_debug("creg_notify: %d, %d, %d, %d", status, lac, ci, tech);
 
        ofono_network_registration_notify(modem, status, lac, ci, tech);