Skip to content

Commit

Permalink
Prevent undefined errors in TapParser if output from scripts failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
tvbeek authored and Dan Cryer committed Dec 3, 2014
1 parent 73d5da1 commit 1206f9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions PHPCI/Plugin/Util/TapParser.php
Expand Up @@ -44,7 +44,7 @@ public function parse()
throw new \Exception('TapParser only supports TAP version 13');
}

if (preg_match(self::TEST_COVERAGE_PATTERN, $lines[count($lines) - 1])) {
if (isset($lines[count($lines) - 1]) && preg_match(self::TEST_COVERAGE_PATTERN, $lines[count($lines) - 1])) {
array_pop($lines);
if ($lines[count($lines) - 1] == "") {
array_pop($lines);
Expand All @@ -58,7 +58,8 @@ public function parse()
$totalTests = (int) $matches[2];
}

if (preg_match(self::TEST_COUNTS_PATTERN, $lines[count($lines) - 1], $matches)) {
if (isset($lines[count($lines) - 1]) &&
preg_match(self::TEST_COUNTS_PATTERN, $lines[count($lines) - 1], $matches)) {
array_pop($lines);
$totalTests = (int) $matches[2];
}
Expand Down

0 comments on commit 1206f9c

Please sign in to comment.