soc.2008.finch: abef8860: Fixes a crash when next_begin_word is ca...

queueram at soc.pidgin.im queueram at soc.pidgin.im
Thu Jun 5 22:45:38 EDT 2008


-----------------------------------------------------------------
Revision: abef8860abbb7cbebfd89a34d86d43457c0b5caf
Ancestor: 0b25c9dd3deaa5c16f7deff33c36af4812f2629a
Author: queueram at soc.pidgin.im
Date: 2008-06-06T02:40:40
Branch: im.pidgin.soc.2008.finch
URL: http://d.pidgin.im/viewmtn/revision/info/abef8860abbb7cbebfd89a34d86d43457c0b5caf

Modified files:
        finch/libgnt/gntentry.c

ChangeLog: 

Fixes a crash when next_begin_word is called on trailing spaces at the end of an entry.

-------------- next part --------------
============================================================
--- finch/libgnt/gntentry.c	46e5f2ae535628dfb6fdf2b465e5fbc173c6739b
+++ finch/libgnt/gntentry.c	fee8246144358805c51bb836d4cac67f6edb71e1
@@ -748,11 +748,13 @@ next_begin_word(const char *text, const 
 	while (text && text < end && g_unichar_isspace(g_utf8_get_char(text)))
 		text = g_utf8_find_next_char(text, end);
 
-	ch = g_utf8_get_char(text);
-	while ((text = g_utf8_find_next_char(text, end)) != NULL && text <= end) {
-		gunichar cur = g_utf8_get_char(text);
-		if (!SAME(ch, cur))
-			break;
+	if (text) {
+		ch = g_utf8_get_char(text);
+		while ((text = g_utf8_find_next_char(text, end)) != NULL && text <= end) {
+			gunichar cur = g_utf8_get_char(text);
+			if (!SAME(ch, cur))
+				break;
+		}
 	}
 	return (text ? text : end);
 }


More information about the Commits mailing list