about summary refs log tree commit diff stats
path: root/src/LYHistory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/LYHistory.c')
-rw-r--r--src/LYHistory.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/LYHistory.c b/src/LYHistory.c
index 3ffbe9d0..b318aa3e 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -837,7 +837,7 @@ PRIVATE void to_stack ARGS1(char *, str)
     /*
      *  Cycle buffer:
      */
-    if (topOfStack == STATUSBUFSIZE) {
+    if (topOfStack >= STATUSBUFSIZE) {
 	topOfStack = 0;
     }
 
@@ -853,6 +853,9 @@ PRIVATE void to_stack ARGS1(char *, str)
 	atexit(free_messages_stack);
     }
 #endif
+    if (topOfStack >= STATUSBUFSIZE) {
+	topOfStack = 0;
+    }
 }
 
 
@@ -873,7 +876,7 @@ PUBLIC void LYstatusline_messages_on_exit ARGS1(
      * probably a single message but let's do it.
      */
     i = topOfStack - 1;
-    while (++i <= STATUSBUFSIZE) {
+    while (++i < STATUSBUFSIZE) {
 	if (buffstack[i] != NULL) {
 	    StrAllocCat(*buf, buffstack[i]);
 	    StrAllocCat(*buf, "\n");