From: Sergio Villar Senin Date: Mon, 28 Jan 2008 12:06:15 +0000 (+0000) Subject: * Do not try to select the first account if there is none X-Git-Tag: git_migration_finished~1754 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=91e95353d50b4492f8d7b9f40968c443be8ff652 * Do not try to select the first account if there is none * Probably helps with NB#78684 pmo-trunk-r4097 --- 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