fix crash when converting to BRR with invalid loop end

issue #2671
This commit is contained in:
tildearrow 2025-09-03 03:58:45 -05:00
parent 779a8d8810
commit 91965bca8c
2 changed files with 3 additions and 2 deletions

View file

@ -1479,7 +1479,8 @@ void DivSample::render(unsigned int formatMask) {
}
}
if (NOT_IN_FORMAT(DIV_SAMPLE_DEPTH_BRR)) { // BRR
int sampleCount=loop?loopEnd:samples;
int sampleCount=isLoopable()?loopEnd:samples;
if (sampleCount>(int)samples) sampleCount=samples;
if (!initInternal(DIV_SAMPLE_DEPTH_BRR,sampleCount)) return;
brrEncode(data16,dataBRR,sampleCount,loop?loopStart:-1,brrEmphasis,brrNoFilter);
}