[VOL-5392]-handled nil pointer exception during onu sw upgrade

Change-Id: I94a2539c91452dd65af3772ad640b267cd0c90f2
Signed-off-by: Akash Soni <akash.soni@radisys.com>
diff --git a/internal/pkg/swupg/onu_image_status.go b/internal/pkg/swupg/onu_image_status.go
index 4948ecb..4423e2c 100755
--- a/internal/pkg/swupg/onu_image_status.go
+++ b/internal/pkg/swupg/onu_image_status.go
@@ -244,13 +244,17 @@
 
 		// optional attributes
 		case me.SoftwareImage_ProductCode:
-			if msgObj.Result == me.Success {
-				image.ProductCode = cmn.TrimStringFromMeOctet(meAttributes[me.SoftwareImage_ProductCode])
-			} else {
-				sResult := msgObj.Result.String()
-				logger.Infow(ctx, "processAttributesReceived - ProductCode",
-					log.Fields{"result": sResult, "unsupported attribute mask": msgObj.UnsupportedAttributeMask, "device-id": oo.deviceID})
-				image.ProductCode = cResponse + sResult
+			// Check if me.SoftwareImage_ImageHash exists in meAttributes
+			if prodAttr, found := meAttributes[me.SoftwareImage_ProductCode]; found {
+				// Process the prod attribute if msgObj.Result is successful
+				if msgObj.Result == me.Success {
+					image.ProductCode = cmn.TrimStringFromMeOctet(prodAttr)
+				} else {
+					sResult := msgObj.Result.String()
+					logger.Infow(ctx, "processAttributesReceived - ProductCode",
+						log.Fields{"result": sResult, "unsupported attribute mask": msgObj.UnsupportedAttributeMask, "device-id": oo.deviceID})
+					image.ProductCode = cResponse + sResult
+				}
 			}
 		case me.SoftwareImage_ImageHash:
 			if msgObj.Result == me.Success {