tolerate missing column headers in server-side print output

pull/8/head
Jordan Liggitt 2018-07-19 17:21:17 -04:00
parent dc5f615152
commit bd559e247c
No known key found for this signature in database
GPG Key ID: 39928704103C7229
1 changed files with 5 additions and 0 deletions

View File

@ -371,6 +371,11 @@ func PrintTable(table *metav1beta1.Table, output io.Writer, options PrintOptions
for _, row := range table.Rows {
first := true
for i, cell := range row.Cells {
if i >= len(table.ColumnDefinitions) {
// https://issue.k8s.io/66379
// don't panic in case of bad output from the server, with more cells than column definitions
break
}
column := table.ColumnDefinitions[i]
if !options.Wide && column.Priority != 0 {
continue