# HG changeset patch # User Sadrul Habib Chowdhury # Date 1183702471 0 # Node ID 8fc91e4379817b3bf8cf7ede191d0feaa48aabf3 # Parent 197ac83893a5f1108baaf98231a1f76e95887355 Possible crash fix. diff -r 197ac83893a5 -r 8fc91e437981 finch/libgnt/gntmenu.c --- a/finch/libgnt/gntmenu.c Fri Jul 06 05:51:08 2007 +0000 +++ b/finch/libgnt/gntmenu.c Fri Jul 06 06:14:31 2007 +0000 @@ -116,18 +116,20 @@ } } -#define GET_VAL(ch) ((ch >= '0' && ch <= '9') ? (ch - '0') : (ch >= 'a' && ch <= 'z') ? (10 + ch - 'a') : ch) +#define GET_VAL(ch) ((ch >= '0' && ch <= '9') ? (ch - '0') : (ch >= 'a' && ch <= 'z') ? (10 + ch - 'a') : 36) static void assign_triggers(GntMenu *menu) { GList *iter; - gboolean bools[36]; + gboolean bools[37]; memset(bools, 0, sizeof(bools)); + bools[36] = 1; + for (iter = menu->list; iter; iter = iter->next) { GntMenuItem *item = iter->data; - char trigger = gnt_menuitem_get_trigger(item); + char trigger = tolower(gnt_menuitem_get_trigger(item)); if (trigger == '\0' || trigger == ' ') continue; bools[(int)GET_VAL(trigger)] = 1; @@ -141,7 +143,7 @@ continue; while (*text) { char ch = tolower(*text++); - if (bools[(int)GET_VAL(ch)]) + if (ch == ' ' || bools[(int)GET_VAL(ch)]) continue; trigger = ch; break;