diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index fc6723502..2c25ab3b4 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -2575,6 +2575,9 @@ int DivEngine::addInstrument(int refChan, DivInstrumentType fallbackType) { DivInstrument* ins=new DivInstrument; int insCount=(int)song.ins.size(); DivInstrumentType prefType; + if (refChan>chans) { + refChan=chans-1; + } if (refChan<0) { prefType=fallbackType; } else {