Skip to content

Commit 126ef44

Browse files
committed
Fix
1 parent 46ab492 commit 126ef44

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

command/ota/status.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,17 @@ func printJson(res any) {
4545
func PrintOtaStatus(otaid, device string, wideOutput bool, cred *config.Credentials) error {
4646
otapi := otaapi.NewClient(cred)
4747

48-
var res any
4948
var err error
5049
if otaid != "" {
51-
res, err = otapi.GetOtaStatusByOtaID(otaid)
52-
if err == nil {
53-
formatOutput(wideOutput, res.(*otaapi.OtaStatusResponse).Ota)
50+
res, err := otapi.GetOtaStatusByOtaID(otaid)
51+
if err == nil && res != nil {
52+
formatOutput(wideOutput, res.Ota)
5453
}
5554
}
5655
if device != "" {
57-
res, err = otapi.GetOtaStatusByDeviceID(device)
58-
if err == nil {
59-
formatOutputSlice(wideOutput, res.(*otaapi.OtaStatusByDeviceResponse).Ota)
56+
res, err := otapi.GetOtaStatusByDeviceID(device)
57+
if err == nil && res != nil {
58+
formatOutputSlice(wideOutput, res.Ota)
6059
}
6160
}
6261
if err != nil {

0 commit comments

Comments
 (0)