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
This commit is contained in:
Claude
2026-04-22 16:58:16 +00:00
parent 8b79261b81
commit 32bd64459e
+5
View File
@@ -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"