Fix #104352: Nil reference panic when FFmpeg can be found (#104353)

Fix a `nil` dereference caused by an extra check on `err`.

Co-authored-by: Nitin Rawat <shvmnrwt@gmail.com>
Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104353
Reviewed-by: Sybren A. Stüvel <sybren@blender.org>
This commit is contained in:
Nitin-Rawat-1 2025-02-17 15:38:08 +01:00 committed by Sybren A. Stüvel
parent eb7177388c
commit e558883c7f

View File

@ -19,12 +19,12 @@ import (
func findFFmpeg() { func findFFmpeg() {
result, err := find_ffmpeg.Find() result, err := find_ffmpeg.Find()
switch { 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"): 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") 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: 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")
} }
} }