changeset 14714:1d084d1ee6fa

[gaim-migrate @ 17468] Make sure things don't go crazy when you add text to a textview which is yet to be given a size. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 12 Oct 2006 03:33:07 +0000
parents 07f572e08773
children 04f03667702f
files console/libgnt/gntutils.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gntutils.c	Thu Oct 12 03:30:25 2006 +0000
+++ b/console/libgnt/gntutils.c	Thu Oct 12 03:33:07 2006 +0000
@@ -59,6 +59,10 @@
 	int width = 0;
 	const char *str = string;
 
+	if (len <= 0) {
+		len = g_utf8_strlen(string, -1);
+	}
+
 	while (width < len && *str) {
 		size = g_unichar_iswide(g_utf8_get_char(str)) ? 2 : 1;
 		if (width + size > len)