[VOL-4117] openonuAdapterGo - HW-test: crash after receiving defective OMCI-msg from ONU

Change-Id: Ib929b98e941f3eb91531b1ca7ea3425ce2fb5723
diff --git a/internal/pkg/onuadaptercore/omci_cc.go b/internal/pkg/onuadaptercore/omci_cc.go
index 1c58250..190d354 100644
--- a/internal/pkg/onuadaptercore/omci_cc.go
+++ b/internal/pkg/onuadaptercore/omci_cc.go
@@ -2863,6 +2863,7 @@
 	return nil
 }
 
+//nolint: gocyclo
 func isSuccessfulResponseWithMibDataSync(omciMsg *omci.OMCI, packet *gp.Packet) bool {
 	for _, v := range responsesWithMibDataSync {
 		if v == omciMsg.MessageType {
@@ -2870,32 +2871,46 @@
 			msgLayer := (*packet).Layer(nextLayer)
 			switch nextLayer {
 			case omci.LayerTypeCreateResponse:
-				if msgLayer.(*omci.CreateResponse).Result == me.Success {
-					return true
+				if resp := msgLayer.(*omci.CreateResponse); resp != nil {
+					if resp.Result == me.Success {
+						return true
+					}
 				}
 			case omci.LayerTypeDeleteResponse:
-				if msgLayer.(*omci.DeleteResponse).Result == me.Success {
-					return true
+				if resp := msgLayer.(*omci.DeleteResponse); resp != nil {
+					if resp.Result == me.Success {
+						return true
+					}
 				}
 			case omci.LayerTypeSetResponse:
-				if msgLayer.(*omci.SetResponse).Result == me.Success {
-					return true
+				if resp := msgLayer.(*omci.SetResponse); resp != nil {
+					if resp.Result == me.Success {
+						return true
+					}
 				}
 			case omci.LayerTypeStartSoftwareDownloadResponse:
-				if msgLayer.(*omci.StartSoftwareDownloadResponse).Result == me.Success {
-					return true
+				if resp := msgLayer.(*omci.StartSoftwareDownloadResponse); resp != nil {
+					if resp.Result == me.Success {
+						return true
+					}
 				}
 			case omci.LayerTypeEndSoftwareDownloadResponse:
-				if msgLayer.(*omci.EndSoftwareDownloadResponse).Result == me.Success {
-					return true
+				if resp := msgLayer.(*omci.EndSoftwareDownloadResponse); resp != nil {
+					if resp.Result == me.Success {
+						return true
+					}
 				}
 			case omci.LayerTypeActivateSoftwareResponse:
-				if msgLayer.(*omci.ActivateSoftwareResponse).Result == me.Success {
-					return true
+				if resp := msgLayer.(*omci.ActivateSoftwareResponse); resp != nil {
+					if resp.Result == me.Success {
+						return true
+					}
 				}
 			case omci.LayerTypeCommitSoftwareResponse:
-				if msgLayer.(*omci.CommitSoftwareResponse).Result == me.Success {
-					return true
+				if resp := msgLayer.(*omci.CommitSoftwareResponse); resp != nil {
+					if resp.Result == me.Success {
+						return true
+					}
 				}
 			}
 		}