diff --git a/lib/cli/Table.php b/lib/cli/Table.php index 1ed18fc..fbe6227 100644 --- a/lib/cli/Table.php +++ b/lib/cli/Table.php @@ -148,14 +148,16 @@ public function getDisplayLines() { $out[] = $border; } - foreach ($this->_rows as $row) { - $row = $this->_renderer->row($row); - $row = explode( PHP_EOL, $row ); - $out = array_merge( $out, $row ); - } + if ($this->_rows) { + foreach ($this->_rows as $row) { + $row = $this->_renderer->row($row); + $row = explode( PHP_EOL, $row ); + $out = array_merge( $out, $row ); + } - if (isset($border)) { - $out[] = $border; + if (isset($border)) { + $out[] = $border; + } } if ($this->_footers) { diff --git a/tests/Test_Table_Ascii.php b/tests/Test_Table_Ascii.php index 6eac675..9f7659c 100644 --- a/tests/Test_Table_Ascii.php +++ b/tests/Test_Table_Ascii.php @@ -249,7 +249,6 @@ public function testDrawWithHeadersNoData() { +----------+----------+ | header 1 | header 2 | +----------+----------+ -+----------+----------+ OUT; $this->assertInOutEquals(array($headers, $rows), $output);