summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-11-15 00:40:48 +0100
committeremkael <emkael@tlen.pl>2018-11-15 00:40:48 +0100
commit4d2495bc8add202c39b8dbf8a4ea059120984999 (patch)
tree7914f5819cf2f26bfa4c308ee5d737ad206c1099
parent738eaca67e73b52bf8253276cdc5920b322ee1d6 (diff)
Bugfixes for detecting whether a board was played
-rw-r--r--tdd/tdd-bootstrap.php5
1 files changed, 4 insertions, 1 deletions
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('&nbsp;', '', $dom->find('td[class="bdc"]', 0)->innertext));
$score = trim(str_replace('&nbsp;', '', $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;
}
}