Skip to content

Commit 4d4b774

Browse files
authored
Table::getDisplayLines() should not output excessive lines
Fix wp-cli#164.
1 parent d788a2c commit 4d4b774

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

lib/cli/Table.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,16 @@ public function getDisplayLines() {
148148
$out[] = $border;
149149
}
150150

151-
foreach ($this->_rows as $row) {
152-
$row = $this->_renderer->row($row);
153-
$row = explode( PHP_EOL, $row );
154-
$out = array_merge( $out, $row );
155-
}
151+
if ($this->_rows) {
152+
foreach ($this->_rows as $row) {
153+
$row = $this->_renderer->row($row);
154+
$row = explode( PHP_EOL, $row );
155+
$out = array_merge( $out, $row );
156+
}
156157

157-
if (isset($border)) {
158-
$out[] = $border;
158+
if (isset($border)) {
159+
$out[] = $border;
160+
}
159161
}
160162

161163
if ($this->_footers) {

0 commit comments

Comments
 (0)