fix: Avoid crash when asking for no existing transition/expiry info (#3771)
mc ilm ls has --expiry and --transition to show for only expiry or transition information, but if one of them doesn't exist, mc crashes. The PR fixes this. Co-authored-by: Anis Elleuch <anis@min.io>
This commit is contained in:
co-authored by
Anis Elleuch
parent
43b03a8532
commit
a88acb58d4
+7
-2
@@ -116,8 +116,10 @@ func (i ilmListMessage) String() string {
|
||||
tbl = newPrettyTable(tableSeperator, fields...)
|
||||
tblContents = getILMHeader(&tbl, alignedHdrLabels...)
|
||||
|
||||
// Reuse the fields
|
||||
fields = nil
|
||||
// If no data to show at all, quit here
|
||||
if len(cellDataNoTags) == 0 && len(cellDataWithTags) == 0 {
|
||||
return tblContents
|
||||
}
|
||||
|
||||
// The data table
|
||||
var tblRowField *[]string
|
||||
@@ -127,6 +129,9 @@ func (i ilmListMessage) String() string {
|
||||
tblRowField = &cellDataNoTags[0]
|
||||
}
|
||||
|
||||
// Reuse the fields
|
||||
fields = nil
|
||||
|
||||
for _, hdr := range *tblRowField {
|
||||
fields = append(fields, Field{ilmThemeRow, len(hdr)})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user