changeset 19652:21e67147f9f0

Do not crash when pressing a key in an empty menu. Thanks to CmdrChalupa in #pidgin for the bug report.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 05 Sep 2007 12:53:51 +0000
parents 450f4a3c4c0f
children e21002d106ab
files finch/libgnt/gntmenu.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntmenu.c	Wed Sep 05 01:12:44 2007 +0000
+++ b/finch/libgnt/gntmenu.c	Wed Sep 05 12:53:51 2007 +0000
@@ -221,8 +221,13 @@
 {
 	/* check for a trigger key */
 	GList *iter;
+	GList *find;
 	GList *nth = g_list_find(menu->list, gnt_tree_get_selection_data(GNT_TREE(menu)));
-	GList *find = find_item_with_trigger(nth->next, NULL, trigger);
+
+	if (nth == NULL)
+		return FALSE;
+		
+	find = find_item_with_trigger(nth->next, NULL, trigger);
 	if (!find)
 		find = find_item_with_trigger(menu->list, nth->next, trigger);
 	if (!find)