From e558883c7f87231499a3c0a75bfb5d631d12028a Mon Sep 17 00:00:00 2001 From: Nitin-Rawat-1 Date: Mon, 17 Feb 2025 15:38:08 +0100 Subject: [PATCH] Fix #104352: Nil reference panic when FFmpeg can be found (#104353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a `nil` dereference caused by an extra check on `err`. Co-authored-by: Nitin Rawat Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104353 Reviewed-by: Sybren A. Stüvel --- cmd/flamenco-worker/find_exes.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/flamenco-worker/find_exes.go b/cmd/flamenco-worker/find_exes.go index b7f6203c..cb5ec0d0 100644 --- a/cmd/flamenco-worker/find_exes.go +++ b/cmd/flamenco-worker/find_exes.go @@ -19,12 +19,12 @@ import ( func findFFmpeg() { result, err := find_ffmpeg.Find() switch { + case err == nil: // Has to be first because of the checks in the next `case`. + log.Info().Str("path", result.Path).Str("version", result.Version).Msg("FFmpeg found on this system") case errors.Is(err, fs.ErrNotExist), strings.Contains(err.Error(), "file not found"): log.Warn().Msg("FFmpeg could not be found on this system, jobs may not run correctly") - case err != nil: - log.Warn().AnErr("cause", err).Msg("there was an unexpected error finding FFmpeg on this system, jobs may not run correctly") default: - log.Info().Str("path", result.Path).Str("version", result.Version).Msg("FFmpeg found on this system") + log.Warn().AnErr("cause", err).Msg("there was an unexpected error finding FFmpeg on this system, jobs may not run correctly") } }