From 32bd64459e5d48d440345b8d74a2111cb1d764bf Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Apr 2026 16:58:16 +0000 Subject: [PATCH] 4-seasons: exit cleanly when all frames fail validation Accessing ${images[-1]} on an empty array under set -u causes a bash error. Guard with an explicit check so a fully-corrupt image directory exits with a clear message instead of a cryptic crash. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- 4-seasons.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/4-seasons.sh b/4-seasons.sh index 49c539a..f480596 100755 --- a/4-seasons.sh +++ b/4-seasons.sh @@ -123,6 +123,11 @@ done [ "$bad" -gt 0 ] && echo "WARNING: skipped $bad corrupt/empty frame(s) of ${#all_images[@]}" [ "$grey" -gt 0 ] && echo "INFO: skipped $grey grey/uniform frame(s) (SEASONS_GREY_STDDEV_MIN=${GREY_MIN})" +if [ "${#images[@]}" -eq 0 ]; then + echo "ERROR: no valid images remain after filtering — skipping $yesterday." + exit 0 +fi + for img in "${images[@]}"; do printf "file '%s'\nduration %s\n" "$img" "$INTERVAL" done > "$temp_file"