From 4d2495bc8add202c39b8dbf8a4ea059120984999 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 15 Nov 2018 00:40:48 +0100 Subject: Bugfixes for detecting whether a board was played --- tdd/tdd-bootstrap.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tdd/tdd-bootstrap.php') diff --git a/tdd/tdd-bootstrap.php b/tdd/tdd-bootstrap.php index b6de1c0..4c0a484 100644 --- a/tdd/tdd-bootstrap.php +++ b/tdd/tdd-bootstrap.php @@ -54,13 +54,16 @@ class Protocol { } function areBoardsPlayed($boards) { + if (!$boards) { + return FALSE; + } foreach ($boards as $board) { $dom = str_get_html($board); $isFirstRow = count($dom->find('td/a')); $contract = trim(str_replace(' ', '', $dom->find('td[class="bdc"]', 0)->innertext)); $score = trim(str_replace(' ', '', $dom->find('td', 5 + $isFirstRow)->innertext)); // note that the contract field for arbitral scores starts with 'A' (e.g. 'ARB' or 'AAA') - if ($score == '' && $contract[0] != 'A') { + if ($score == '' && (!strlen($contract) || $contract[0] != 'A')) { return FALSE; } } -- cgit v1.2.3