From 3cfd4ebd102401760f09fadab41f1eb1f94dd418 Mon Sep 17 00:00:00 2001 From: prayerie Date: Sun, 19 Apr 2026 16:20:26 +0100 Subject: [PATCH] sample.cpp: clamp loop_start/loop_length to prevent edge case --- libntxm/common/source/sample.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libntxm/common/source/sample.cpp b/libntxm/common/source/sample.cpp index f8fe094..04b5389 100644 --- a/libntxm/common/source/sample.cpp +++ b/libntxm/common/source/sample.cpp @@ -567,6 +567,9 @@ void Sample::delPart(u32 startsample, u32 endsample) } } + loop_start = ntxm_clamp(loop_start, 0, size - 1); + loop_length = ntxm_clamp(loop_length, 0, size - loop_start - 1); + setLoopStartAndLength(getLoopStart(), getLoopLength()); onSampleDataChanged(); }