Skip to content

Commit e6f67c2

Browse files
committed
feat(object-storage): fix credentials create nil pointer
1 parent e6f29a5 commit e6f67c2

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

internal/cmd/object-storage/credentials/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func outputResult(p *print.Printer, outputFormat, credentialsGroupLabel string,
134134

135135
return p.OutputResult(outputFormat, resp, func() error {
136136
expireDate := "Never"
137-
if resp.Expires.IsSet() && *resp.Expires.Get() != "" {
137+
if resp.Expires.IsSet() && resp.Expires.Get() != nil && *resp.Expires.Get() != "" {
138138
expireDate = *resp.Expires.Get()
139139
}
140140

internal/cmd/object-storage/credentials/create/create_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ func TestOutputResult(t *testing.T) {
238238
},
239239
wantErr: false,
240240
},
241+
{
242+
name: "minimal",
243+
args: args{
244+
createAccessKeyResponse: &objectstorage.CreateAccessKeyResponse{
245+
Expires: *objectstorage.NewNullableString(nil),
246+
},
247+
},
248+
wantErr: false,
249+
},
241250
}
242251
params := testparams.NewTestParams()
243252
for _, tt := range tests {

0 commit comments

Comments
 (0)