From 91e95353d50b4492f8d7b9f40968c443be8ff652 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Mon, 28 Jan 2008 12:06:15 +0000 Subject: [PATCH] * Do not try to select the first account if there is none * Probably helps with NB#78684 pmo-trunk-r4097 --- src/widgets/modest-account-view.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/widgets/modest-account-view.c b/src/widgets/modest-account-view.c index a634895..3a164c1 100644 --- a/src/widgets/modest-account-view.c +++ b/src/widgets/modest-account-view.c @@ -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 -- 1.7.9.5