Fix crash on clearing new Move List window
[xboard.git] / history.c
index b6c63ad..503f6a0 100644 (file)
--- a/history.c
+++ b/history.c
@@ -28,9 +28,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
 #include <string.h>
 
 #include "common.h"
@@ -177,7 +174,7 @@ void MemoContentUpdated()
 {
     int caretPos;
 
-    DoHighlight( lastCurrent, FALSE );
+    if(lastCurrent <= currLast) DoHighlight( lastCurrent, FALSE );
     DoHighlight( currCurrent, TRUE );
 
     lastFirst = currFirst;