Skip to content

Commit

Permalink
replace_ranges: Raise error if passing ranges past smaller clip to pl…
Browse files Browse the repository at this point in the history
…ugins
  • Loading branch information
LightArrowsEXE committed Nov 16, 2024
1 parent a1fc1ab commit da15e40
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vstools/utils/ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ def _func(n: int) -> vs.VideoNode: # type: ignore

b_ranges = normalize_ranges(clip_b, ranges)
do_splice_trim = len(b_ranges) <= 15
min_frame_num = min(clip_a.num_frames, clip_b.num_frames)

if not do_splice_trim and any(e >= min_frame_num for _, e in b_ranges):
raise CustomValueError(
f'You cannot replace frames that are out of bounds ({min_frame_num=})!',
replace_ranges, [r for r in b_ranges if r[1] >= min_frame_num]
)

if clip_a.num_frames != clip_b.num_frames:
warnings.warn(
Expand Down

0 comments on commit da15e40

Please sign in to comment.