From b681d32546ddc26fb60e51c6076336c7ae7f953d Mon Sep 17 00:00:00 2001 From: vonavi Date: Fri, 12 Dec 2014 08:22:07 +0300 Subject: [PATCH] Script 'game-add': cover the case when a player was not found in tour_info. --- game-add | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game-add b/game-add index 28a2de8..3d4d98c 100755 --- a/game-add +++ b/game-add @@ -112,8 +112,8 @@ function game_get_info { # Find the white and black players local line0=$(grep " ${players[0]} " $tour_info) local line1=$(grep " ${players[1]} " $tour_info) - [[ $line0 == $line1 ]] \ - || die "No game between ${players[0]} and ${players[1]} found in ${tour_info}." + [[ -z $line0 || -z $line1 || $line0 != $line1 ]] \ + && die "No game between ${players[0]} and ${players[1]} found in ${tour_info}." [[ $line0 =~ ^((${date_re})\ +([^\ ]+)\ +-\ +([^\ ]+))(.*)$ ]] white=${BASH_REMATCH[3]} black=${BASH_REMATCH[4]}