]> git.sesse.net Git - remoteglot/commitdiff
Deal with strange PGN download failures.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 23 Nov 2014 13:44:28 +0000 (14:44 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 23 Nov 2014 13:44:28 +0000 (14:44 +0100)
remoteglot.pl

index 63cdac205d89a57e036e12b59d604212e0cbfbba..917a6a01300a145e4f537d9ab07394da01d16cea 100755 (executable)
@@ -268,7 +268,7 @@ sub handle_pgn {
        }
 
        my $pgn = Chess::PGN::Parse->new(undef, $body);
        }
 
        my $pgn = Chess::PGN::Parse->new(undef, $body);
-       if (!defined($pgn) || !$pgn->read_game()) {
+       if (!defined($pgn) || !$pgn->read_game() || $body !~ /^\[/) {
                warn "Error in parsing PGN from $url\n";
        } else {
                eval {
                warn "Error in parsing PGN from $url\n";
        } else {
                eval {