[VOL-5421] - fix for crash during ChildDeviceLost

Change-Id: I4cbc4367ad829ec69b5928026789bb48044348f3
Signed-off-by: Sridhar Ravindra <sridhar.ravindra@radisys.com>
diff --git a/internal/pkg/resourcemanager/resourcemanager.go b/internal/pkg/resourcemanager/resourcemanager.go
index 3fde9e0..b8053f4 100755
--- a/internal/pkg/resourcemanager/resourcemanager.go
+++ b/internal/pkg/resourcemanager/resourcemanager.go
@@ -577,6 +577,11 @@
 
 	intfOnuIDuniID := fmt.Sprintf("%d,%d,%d", rsrcMgr.PonIntfID, onuID, uniID)
 
+	if rsrcMgr.PonRsrMgr == nil || rsrcMgr.TechprofileRef == nil {
+		logger.Warn(ctx, "PonRsrMgr or TechprofileRef is nil")
+		return
+	}
+
 	AllocIDs := rsrcMgr.PonRsrMgr.GetCurrentAllocIDForOnu(ctx, intfOnuIDuniID)
 
 	if err := rsrcMgr.TechprofileRef.FreeResourceID(ctx, rsrcMgr.PonIntfID,