diff --git a/lib/cli/Table.php b/lib/cli/Table.php index d79c16f..323b97d 100644 --- a/lib/cli/Table.php +++ b/lib/cli/Table.php @@ -164,16 +164,16 @@ public function display() { public function displayRow(array $row) { // Update widths if this row has wider content $row = $this->checkRow($row); - + // Recalculate widths for the renderer $this->_renderer->setWidths($this->_width, false); - + $rendered_row = $this->_renderer->row($row); $row_lines = explode( PHP_EOL, $rendered_row ); foreach ( $row_lines as $line ) { Streams::line( $line ); } - + $border = $this->_renderer->border(); if (isset($border)) { Streams::line( $border ); @@ -203,10 +203,12 @@ 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 ); + } } // Only add final border if there are rows