From 0040d8cb7329ff41f7047f8486ae47765e45abbe Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 16 Aug 2011 23:10:59 +0200 Subject: [PATCH] Fix crash on start without settings file A primordial -1 in currCurrent caused a crash when WinBoard was started without ini filein game-viewer mode. --- evalgraph.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/evalgraph.c b/evalgraph.c index f386df3..5fc735e 100644 --- a/evalgraph.c +++ b/evalgraph.c @@ -87,10 +87,13 @@ static int GetPvScore( int index ) char* MakeEvalTitle( char * title) { - int score = currPvInfo[ currCurrent ].score; - int depth = currPvInfo[ currCurrent ].depth; + int score, depth; static char buf[MSG_SIZ]; + if( currCurrent <0 ) return title; // currCurrent = -1 crashed WB on start without ini file! + score = currPvInfo[ currCurrent ].score; + depth = currPvInfo[ currCurrent ].depth; + if( depth <=0 ) return title; if( currCurrent & 1 ) score = -score; /* Flip score for black */ snprintf(buf, MSG_SIZ, "%s {%s%.2f/%-2d %d}", title, score>0 ? "+" : " ", score/100., depth, (currPvInfo[currCurrent].time+50)/100); -- 1.7.0.4