gui: Fix a bug in align_str().
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index b37f8fbd5d6db608b9c3086f508809aa52500737..5b44819c05afc074fadca3a5a7d5c1ece9fe8b8f 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -309,7 +309,7 @@ static int align_str(WINDOW* win, char *str, unsigned int len,
                num = 0;
        }
        /* replace newlines by spaces */
-       for (i = 0; i < len; i++) {
+       for (i = 0; i < len && str[i]; i++) {
                if (str[i] == '\n')
                        str[i] = ' ';
        }