fix possible ins create type error

when cursor is outside
This commit is contained in:
tildearrow 2024-11-08 03:19:49 -05:00
parent 3d7079226f
commit 826d1730e0

View file

@ -2575,6 +2575,9 @@ int DivEngine::addInstrument(int refChan, DivInstrumentType fallbackType) {
DivInstrument* ins=new DivInstrument; DivInstrument* ins=new DivInstrument;
int insCount=(int)song.ins.size(); int insCount=(int)song.ins.size();
DivInstrumentType prefType; DivInstrumentType prefType;
if (refChan>chans) {
refChan=chans-1;
}
if (refChan<0) { if (refChan<0) {
prefType=fallbackType; prefType=fallbackType;
} else { } else {