--- libgnomekbd/gkbd-keyboard-drawing.c	2007-05-20 15:20:19.000000000 +0200
+++ /home/gc/build/libgnomekbd-2.19.90/libgnomekbd/gkbd-keyboard-drawing.c	2007-08-14 20:02:46.000000000 +0200
@@ -918,6 +918,9 @@
 		g = drawing->groupLevels[glp]->group;
 		l = drawing->groupLevels[glp]->level;
 
+		if (keycode > XkbMaxLegalKeyCode) // double insurance against crashy keycode -1 on x86_64
+		    continue;
+
 		if (g < 0 || g >= XkbKeyNumGroups (drawing->xkb, keycode))
 			continue;
 		if (l < 0
@@ -1539,6 +1542,8 @@
 				guint keycode = find_keycode (drawing,
 							      xkbkey->name.
 							      name);
+				if ((guint)-1 == keycode) // don't add the -1 keycode since x11lib crashes in XkbKeyNumGroups when retreiving group for keycode -1 on x86_64 
+				    continue;
 
 #ifdef KBDRAW_DEBUG
 				printf
