diff --git a/CHANGELOG.md b/CHANGELOG.md index 1458774ba..3f4ccf1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed +- Fix playout builder crash with improperly configured pad filler preset +- Properly validate filler preset mode pad to require `filler pad to nearest minute` value ## [0.8.3-beta] - 2023-11-22 ### Added diff --git a/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs b/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs index 706111cd4..0f5a4bfc3 100644 --- a/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs +++ b/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs @@ -223,6 +223,17 @@ public abstract class PlayoutModeSchedulerBase : IPlayoutModeScheduler whe Logger.LogError("Multiple pad-to-nearest-minute values are invalid; no filler will be used"); return new List { playoutItem }; } + + // missing pad-to-nearest-minute value is invalid; use no filler + FillerPreset invalidPadFiller = allFiller + .FirstOrDefault(f => f.FillerMode == FillerMode.Pad && f.PadToNearestMinute.HasValue == false); + if (invalidPadFiller is not null) + { + Logger.LogError( + "Pad filler ({Filler}) without pad-to-nearest-minute value is invalid; no filler will be used", + invalidPadFiller.Name); + return new List { playoutItem }; + } List effectiveChapters = chapters; if (allFiller.All(fp => fp.FillerKind != FillerKind.MidRoll) || effectiveChapters.Count <= 1) diff --git a/ErsatzTV/Validators/FillerPresetEditViewModelValidator.cs b/ErsatzTV/Validators/FillerPresetEditViewModelValidator.cs index a429d3984..890ff81b7 100644 --- a/ErsatzTV/Validators/FillerPresetEditViewModelValidator.cs +++ b/ErsatzTV/Validators/FillerPresetEditViewModelValidator.cs @@ -21,6 +21,9 @@ public class FillerPresetEditViewModelValidator : AbstractValidator fp.FillerMode == FillerMode.Duration, () => RuleFor(fp => fp.Duration).NotNull()); + When( + fp => fp.FillerMode == FillerMode.Pad, + () => RuleFor(fp => fp.PadToNearestMinute).NotNull()); When( fp => fp.CollectionType == ProgramScheduleItemCollectionType.Collection,