[VOL-5556] handled nil pointer exception
Change-Id: I2c9c52d081f90aa2ec10a7ce7058a91a95ea899b
Signed-off-by: bseeniva <balaji.seenivasan@radisys.com>
diff --git a/VERSION b/VERSION
index 55fcfb7..5658920 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.13.13
+2.13.14
diff --git a/internal/pkg/swupg/onu_image_status.go b/internal/pkg/swupg/onu_image_status.go
index e432c58..1b5d6a6 100755
--- a/internal/pkg/swupg/onu_image_status.go
+++ b/internal/pkg/swupg/onu_image_status.go
@@ -257,14 +257,19 @@
}
}
case me.SoftwareImage_ImageHash:
- if msgObj.Result == me.Success {
- bytes, _ := me.InterfaceToOctets(meAttributes[me.SoftwareImage_ImageHash])
- image.Hash = hex.EncodeToString(bytes)
- } else {
- sResult := msgObj.Result.String()
- logger.Infow(ctx, "processAttributesReceived - ImageHash",
- log.Fields{"result": sResult, "unsupported attribute mask": msgObj.UnsupportedAttributeMask, "device-id": oo.deviceID})
- image.Hash = cResponse + sResult
+ // Check if me.SoftwareImage_ImageHash exists in meAttributes
+ if hashAttr, found := meAttributes[me.SoftwareImage_ImageHash]; found {
+ // Process the hash attribute if msgObj.Result is successful
+ if msgObj.Result == me.Success {
+ bytes, _ := me.InterfaceToOctets(hashAttr)
+ image.Hash = hex.EncodeToString(bytes)
+ } else {
+ // Handle unsuccessful result with logging and image.Hash update
+ sResult := msgObj.Result.String()
+ logger.Infow(ctx, "processAttributesReceived - ImageHash",
+ log.Fields{"result": sResult, "unsupported attribute mask": msgObj.UnsupportedAttributeMask, "device-id": oo.deviceID})
+ image.Hash = cResponse + sResult
+ }
}
}
}