diff console/libgnt/gntwidget.c @ 14881:5228f8cf2a6a

[gaim-migrate @ 17650] Print a debug message if someone tries to specify a binding for some non-existent action. Make sure the conversation windows aren't too large to cause a crash. raise(SIGABRT) instead of exit() to force a coredump if something goes wrong with stdin. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 01 Nov 2006 20:59:23 +0000
parents 70623f0d5cdc
children 065e7ac30338
line wrap: on
line diff
--- a/console/libgnt/gntwidget.c	Wed Nov 01 19:23:39 2006 +0000
+++ b/console/libgnt/gntwidget.c	Wed Nov 01 20:59:23 2006 +0000
@@ -711,14 +711,24 @@
 register_binding(GntWidgetClass *klass, const char *name, const char *trigger, GList *list)
 {
 	GntWidgetActionParam *param;
+	GntWidgetAction *action;
 
 	if (name == NULL || *name == '\0') {
 		g_hash_table_remove(klass->bindings, (char*)trigger);
 		return;
 	}
 
+	action = g_hash_table_lookup(klass->actions, name);
+	if (!action) {
+		g_printerr("GntWidget: Invalid action name %s for %s\n",
+				name, g_type_name(G_OBJECT_CLASS_TYPE(klass)));
+		if (list)
+			g_list_free(list);
+		return;
+	}
+
 	param = g_new0(GntWidgetActionParam, 1);
-	param->action = g_hash_table_lookup(klass->actions, name);
+	param->action = action;
 	param->list = list;
 	g_hash_table_replace(klass->bindings, g_strdup(trigger), param);
 }