From cb564829e951d47a5d8e1cf781b82a7a4b9754ba Mon Sep 17 00:00:00 2001 From: Matthias Bertschy Date: Fri, 14 Feb 2025 07:56:20 +0100 Subject: [PATCH] add nil check for appProfile in ApplicationProfileCacheImpl Signed-off-by: Matthias Bertschy --- .../applicationprofilecache/applicationprofilecache.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/objectcache/applicationprofilecache/applicationprofilecache.go b/pkg/objectcache/applicationprofilecache/applicationprofilecache.go index 66eae53b..842cb9bc 100644 --- a/pkg/objectcache/applicationprofilecache/applicationprofilecache.go +++ b/pkg/objectcache/applicationprofilecache/applicationprofilecache.go @@ -119,6 +119,13 @@ func (ap *ApplicationProfileCacheImpl) handleUserManagedProfile(appProfile *v1be // indexContainerCallStacks builds the search index for a container's call stacks and removes them from the profile func (ap *ApplicationProfileCacheImpl) indexContainerCallStacks(containerID, containerName string, appProfile *v1beta1.ApplicationProfile) { + if appProfile == nil { + logger.L().Warning("ApplicationProfileCacheImpl - application profile is nil", + helpers.String("containerID", containerID), + helpers.String("containerName", containerName)) + return + } + // Initialize container index if needed if !ap.containerCallStacks.Has(containerID) { ap.containerCallStacks.Set(containerID, &ContainerCallStackIndex{