changeset 2457:e6b9246b33fd

[gaim-migrate @ 2470] stupid, stupid committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 09 Oct 2001 18:01:06 +0000
parents 308f010ed664
children 8208e2016d9b
files src/gtkspell.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkspell.c	Tue Oct 09 16:23:08 2001 +0000
+++ b/src/gtkspell.c	Tue Oct 09 18:01:06 2001 +0000
@@ -354,12 +354,11 @@
 		if (iswordsep(GTK_TEXT_INDEX(gtktext, end))) break;
 	}
 
-	if (buf) {
-		char *tmp = g_malloc(end - start + 1);
+	if (buf && (end - start + 1 > 0)) {
+		*buf = g_malloc(end - start + 1);
 		for (pos = start; pos < end; pos++) 
-			tmp[pos-start] = GTK_TEXT_INDEX(gtktext, pos);
-		tmp[pos-start] = 0;
-		*buf = tmp;
+			(*buf)[pos-start] = GTK_TEXT_INDEX(gtktext, pos);
+		(*buf)[pos-start] = 0;
 	}
 
 	if (pstart) *pstart = start;