[Xfce4-commits] <xfce4-xkb-plugin:master> Make sure we don't crash if the first iter could not be retrieved.
Jérôme Guelfucci
noreply at xfce.org
Fri Apr 29 19:52:02 CEST 2011
Updating branch refs/heads/master
to bdcdddb5ae6a2fda9bfd2a5fd39d8ac29ea613fb (commit)
from f924604a1a96a3db96af982826e1c120cf3cbdfe (commit)
commit bdcdddb5ae6a2fda9bfd2a5fd39d8ac29ea613fb
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Fri Apr 29 18:55:16 2011 +0200
Make sure we don't crash if the first iter could not be retrieved.
panel-plugin/xkb-settings-dialog.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/panel-plugin/xkb-settings-dialog.c b/panel-plugin/xkb-settings-dialog.c
index 6b15ce6..238c9f9 100644
--- a/panel-plugin/xkb-settings-dialog.c
+++ b/panel-plugin/xkb-settings-dialog.c
@@ -325,7 +325,8 @@ xkb_settings_get_group_count (t_xkb *xkb)
gint count = 1;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (xkb->layout_tree_view));
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter);
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
+ return 0;
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter))
count++;
return count;
@@ -452,18 +453,20 @@ xkb_settings_default_layout_toggled (GtkCellRendererToggle *renderer,
GtkTreeIter iter;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (xkb->layout_tree_view));
- gtk_tree_model_get_iter_first (model, &iter);
- do
+ if (gtk_tree_model_get_iter_first (model, &iter))
{
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, DEFAULT_LAYOUT, FALSE, -1);
- } while (gtk_tree_model_iter_next (model, &iter));
+ do
+ {
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, DEFAULT_LAYOUT, FALSE, -1);
+ } while (gtk_tree_model_iter_next (model, &iter));
- if (gtk_tree_model_get_iter_from_string (model, &iter, path))
- {
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, DEFAULT_LAYOUT, TRUE, -1);
+ if (gtk_tree_model_get_iter_from_string (model, &iter, path))
+ {
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, DEFAULT_LAYOUT, TRUE, -1);
+ }
+ xkb_settings_update_from_ui (xkb);
}
- xkb_settings_update_from_ui (xkb);
}
static gboolean
More information about the Xfce4-commits
mailing list