Fixed bug in TEXT_WordBreak that was variously throwing Lotus Notes
into an infinite loop or causing it to crash.
diff --git a/dlls/user/text.c b/dlls/user/text.c
index b591ad8..0bae181 100644
--- a/dlls/user/text.c
+++ b/dlls/user/text.c
@@ -356,13 +356,15 @@
/* If there was one or the first character didn't fit then */
if (word_fits)
{
+ int next_is_space;
/* break the line before/after that character */
if (!(format & (DT_RIGHT | DT_CENTER)) || *p != SPACE)
p++;
+ next_is_space = (p - str) < *len_str && *p == SPACE;
*len_str = p - str;
/* and if the next character is a space then discard it. */
*chars_used = *len_str;
- if (*p == SPACE)
+ if (next_is_space)
(*chars_used)++;
}
/* Suppose there was none. */