lookup-apn: Fix crash on no APNs found
authorOleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Wed, 5 Oct 2011 13:18:30 +0000 (16:18 +0300)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 12 Oct 2011 21:34:46 +0000 (16:34 -0500)
tools/lookup-apn.c

index 1df8be0..2fa6b5b 100644 (file)
@@ -45,7 +45,11 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc)
        apns = mbpi_lookup(match_mcc, match_mnc, TRUE, &error);
 
        if (apns == NULL) {
-               g_print("Lookup failed: %s\n", error->message);
+               if (error != NULL) {
+                       g_printerr("Lookup failed: %s\n", error->message);
+                       g_error_free(error);
+               }
+
                return;
        }