- acc_data = modest_account_mgr_get_account_data (mgr, (const gchar*) default_acc);
- server_acc_id = (const gchar *) acc_data->store_account->account_name;
-
- modest_folder_view_set_account_id_of_visible_server_account (folder_view, server_acc_id);
-
+ settings = modest_account_mgr_load_account_settings (mgr, (const gchar*) default_acc);
+ /* If there was any problem with the settings storage
+ the settings could be NULL */
+ if (settings) {
+ ModestServerAccountSettings *store_settings;
+ store_settings = modest_account_settings_get_store_settings (settings);
+
+ if (store_settings) {
+ server_acc_id = modest_server_account_settings_get_account_name (store_settings);
+ modest_folder_view_set_account_id_of_visible_server_account (folder_view, server_acc_id);
+ g_object_unref (store_settings);
+ }
+ g_object_unref (settings);
+ }