From c2cfa10336a85c937ccfc464bd3d322308ec8861 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 12 Jul 2025 11:40:50 -0400 Subject: [PATCH] Fix nil pointer dereference panic in thumbnail subscription during shutdown (#892) * Initial plan * Fix nil pointer dereference in thumbnail subscription handling Add nil check for msg after subscription.Receive() returns error to prevent panic when accessing msg.Metadata. When an error occurs or msg is nil, continue to next iteration instead of trying to process the message. Co-authored-by: tankerkiller125 <3457368+tankerkiller125@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tankerkiller125 <3457368+tankerkiller125@users.noreply.github.com> --- backend/app/api/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/app/api/main.go b/backend/app/api/main.go index 0e79e6e1..6627cbb8 100644 --- a/backend/app/api/main.go +++ b/backend/app/api/main.go @@ -369,6 +369,11 @@ func run(cfg *config.Config) error { log.Debug().Msg("received thumbnail generation request from pubsub topic") if err != nil { log.Err(err).Msg("failed to receive message from pubsub topic") + continue + } + if msg == nil { + log.Warn().Msg("received nil message from pubsub topic") + continue } groupId, err := uuid.Parse(msg.Metadata["group_id"]) if err != nil {