When a new game started and a previous game had filled the Move List
window, a crash occurred because an attempt was made to undo the
highlighting of a no-longer-existing move, and then scrolling to it.
{
int caretPos;
- DoHighlight( lastCurrent, FALSE );
+ if(lastCurrent <= currLast) DoHighlight( lastCurrent, FALSE );
DoHighlight( currCurrent, TRUE );
lastFirst = currFirst;
Arg args[10];
char *s;
GetWidgetText(&historyOptions[0], &s);
- if(caretPos < 0) caretPos = strlen(s);
+ if(caretPos < 0 || caretPos > strlen(s)) caretPos = strlen(s);
XtSetArg(args[0], XtNdisplayCaret, False);
XtSetArg(args[1], XtNinsertPosition, caretPos); // this triggers scrolling in Xaw
XtSetValues(historyOptions[0].handle, args, 2);