soc.2008.finch: a4f018ff: Fix a crash when correcting a spelling f...

sadrul at pidgin.im sadrul at pidgin.im
Tue Sep 9 22:40:23 EDT 2008


-----------------------------------------------------------------
Revision: a4f018ff0635d7135e0dc0e15af89e3bc6f17ff7
Ancestor: 5d89479d6528b46fed537e8e0f3a00f15ac7e3e5
Author: sadrul at pidgin.im
Date: 2008-09-10T02:39:14
Branch: im.pidgin.soc.2008.finch
URL: http://d.pidgin.im/viewmtn/revision/info/a4f018ff0635d7135e0dc0e15af89e3bc6f17ff7

Modified files:
        finch/libgnt/gntentry.c

ChangeLog: 

Fix a crash when correcting a spelling from the context menu.

-------------- next part --------------
============================================================
--- finch/libgnt/gntentry.c	bd2ee4fd5884b198c96a46b7f2b1f834b2572e7a
+++ finch/libgnt/gntentry.c	99c962c789f4554e743fe41ae6c813d1050394a4
@@ -1088,7 +1088,7 @@ gnt_entry_key_pressed(GntWidget *widget,
 				if (entry->spell->cursor_word) {
 					if (is_word_break(entry->start, str)) {
 						/* The current word just ended. Spell check it */
-						const char *lend = entry->start + lastw->start + lastw->length + 1;
+						const char *lend = lastw ? (entry->start + lastw->start + lastw->length + 1) : NULL;
 						lastw = entry->spell->cursor_word;
 						lastw->length = entry->cursor - entry->start - lastw->start;
 						check_entry_word(entry, entry->spell->cursor_word);
@@ -1098,7 +1098,7 @@ gnt_entry_key_pressed(GntWidget *widget,
 								/* The pressed whitespace split one word into two */
 								lastw = g_new0(GntEntryWord, 1);
 								lastw->start = n - entry->start;
-								lastw->length = lend - entry->start - lastw->start;
+								lastw->length = lend ? (lend - entry->start - lastw->start) : 0;
 								lastw->prev = entry->spell->cursor_word;
 								lastw->next = entry->spell->cursor_word->next;
 								entry->spell->cursor_word->next = lastw;


More information about the Commits mailing list