From e6f6de71cc51251a3ef202521e080cc7603a673d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 24 Nov 2014 20:41:10 +0100 Subject: [PATCH] Fix some warnings. --- remoteglot.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/remoteglot.pl b/remoteglot.pl index 917a6a0..61e7237 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -760,7 +760,7 @@ sub output_json { $json->{'refutation_lines'} = \%refutation_lines; my $encoded = JSON::XS::encode_json($json); - unless ($historic_json_only) { + unless ($historic_json_only || !defined($remoteglotconf::json_output)) { atomic_set_contents($remoteglotconf::json_output, $encoded); } @@ -1014,9 +1014,10 @@ sub find_clock_start { my $pos = shift; # If the game is over, the clock is stopped. - if ($pos->{'result'} eq '1-0' || - $pos->{'result'} eq '1/2-1/2' || - $pos->{'result'} eq '0-1') { + if (exists($pos->{'result'}) && + ($pos->{'result'} eq '1-0' || + $pos->{'result'} eq '1/2-1/2' || + $pos->{'result'} eq '0-1')) { return; } @@ -1025,6 +1026,11 @@ sub find_clock_start { return; } + # TODO(sesse): Maybe we can get the number of moves somehow else for FICS games. + if (!exists($pos->{'pretty_history'})) { + return; + } + my $id = id_for_pos($pos); if (exists($clock_target_for_pos{$id})) { if ($pos->{'toplay'} eq 'W') { -- 2.39.2