Mercurial > pidgin.yaz
changeset 14685:972ff6ca923f
[gaim-migrate @ 17437]
Fix Coverity CIDs 141 & 142 - the return value of
gtk_tree_selection_get_selected() should be checked to ensure something
is selected.
I also sensitized/desensitized the buttons as appropriate, which probably
renders the return checking redundant, but I'm playing safe.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 07 Oct 2006 17:01:58 +0000 |
parents | e6ea3ea8efe9 |
children | 7c47556216ec |
files | gtk/plugins/gevolution/add_buddy_dialog.c gtk/plugins/gevolution/assoc-buddy.c |
diffstat | 2 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk/plugins/gevolution/add_buddy_dialog.c Fri Oct 06 18:25:18 2006 +0000 +++ b/gtk/plugins/gevolution/add_buddy_dialog.c Sat Oct 07 17:01:58 2006 +0000 @@ -95,7 +95,8 @@ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); - gtk_tree_selection_get_selected(selection, NULL, &iter); + if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) + return; gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, COLUMN_NAME, &fullname, @@ -343,7 +344,11 @@ static void selected_cb(GtkTreeSelection *sel, GevoAddBuddyDialog *dialog) { - gtk_widget_set_sensitive(dialog->select_button, TRUE); + GtkTreeSelection *selection; + + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); + gtk_widget_set_sensitive(dialog->select_button, + gtk_tree_selection_get_selected(selection, NULL, NULL)); } static void
--- a/gtk/plugins/gevolution/assoc-buddy.c Fri Oct 06 18:25:18 2006 +0000 +++ b/gtk/plugins/gevolution/assoc-buddy.c Sat Oct 07 17:01:58 2006 +0000 @@ -105,7 +105,11 @@ static void selected_cb(GtkTreeSelection *sel, GevoAssociateBuddyDialog *dialog) { - gtk_widget_set_sensitive(dialog->assoc_button, TRUE); + GtkTreeSelection *selection; + + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); + gtk_widget_set_sensitive(dialog->assoc_button, + gtk_tree_selection_get_selected(selection, NULL, NULL)); } static void @@ -276,7 +280,8 @@ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); - gtk_tree_selection_get_selected(selection, NULL, &iter); + if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) + return; gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, COLUMN_NAME, &fullname,