* Do not try to select the first account if there is none
authorSergio Villar Senin <svillar@igalia.com>
Mon, 28 Jan 2008 12:06:15 +0000 (12:06 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 28 Jan 2008 12:06:15 +0000 (12:06 +0000)
* Probably helps with NB#78684

pmo-trunk-r4097

src/widgets/modest-account-view.c

index a634895..3a164c1 100644 (file)
@@ -637,16 +637,14 @@ modest_account_view_select_account (ModestAccountView *account_view,
 static void
 modest_account_view_select_first_account (ModestAccountView *account_view)
 {
-       GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (account_view));
-       g_return_if_fail (model != NULL);
-
        GtkTreeIter iter;
-       gtk_tree_model_get_iter_first (model, &iter);
-
-       GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (account_view));
-       g_return_if_fail (selection != NULL);
+       GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (account_view));
 
-       gtk_tree_selection_select_iter (selection, &iter);
+       if (gtk_tree_model_get_iter_first (model, &iter)) {
+               GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (account_view));
+       
+               gtk_tree_selection_select_iter (selection, &iter);
+       }
 }
 
 static void