2007-07-24 Murray Cumming <murrayc@murrayc.com>
[modest] / src / maemo / modest-maemo-global-settings-dialog.c
index 1857c72..b44f141 100644 (file)
@@ -478,8 +478,8 @@ on_range_error (HildonNumberEditor *editor,
 static ModestConnectedVia
 current_connection (void)
 {
-       TnyAccountStore *account_store;
-       TnyDevice *device;
+       TnyAccountStore *account_store = NULL;
+       TnyDevice *device = NULL;
        ModestConnectedVia retval = MODEST_CONNECTED_VIA_ANY;
        
        account_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
@@ -494,15 +494,17 @@ current_connection (void)
                ConIcIap *iap = tny_maemo_conic_device_get_iap (
                        TNY_MAEMO_CONIC_DEVICE (device), iap_id);
                const gchar *bearer_type = con_ic_iap_get_bearer_type (iap);
-                       
-               if (!strcmp (bearer_type, CON_IC_BEARER_WLAN_INFRA) ||
-                   !strcmp (bearer_type, CON_IC_BEARER_WLAN_ADHOC))
-                       retval = MODEST_CONNECTED_VIA_WLAN;
-               else
-                       retval = MODEST_CONNECTED_VIA_ANY;
+               if (bearer_type) {
+                       if (!strcmp (bearer_type, CON_IC_BEARER_WLAN_INFRA) ||
+                           !strcmp (bearer_type, CON_IC_BEARER_WLAN_ADHOC))
+                               retval = MODEST_CONNECTED_VIA_WLAN;
+                       else
+                               retval = MODEST_CONNECTED_VIA_ANY;
+               }
        
                g_object_unref (iap);
        }
+       
        g_object_unref (device);
 
        return retval;