It doesn't appear to be an error to have an invalid instrument index (#755)

I've seen an xm file that plays fine in milkytracker and other places,
but has instrument indexes which are too high. They are just treated as
non-existent :)

- [x] no changelog update needed
This commit is contained in:
Gwilym Inzani 2024-08-28 12:34:55 +01:00 committed by GitHub
commit 605173bf65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -112,8 +112,10 @@ pub fn parse_module(module: &Module) -> agb_tracker_interop::Track {
} else { } else {
let instrument_index = (slot.instrument - 1) as usize; let instrument_index = (slot.instrument - 1) as usize;
if let InstrumentType::Default(ref instrument) = if let Some(InstrumentType::Default(ref instrument)) = module
module.instrument[instrument_index].instr_type .instrument
.get(instrument_index)
.map(|instrument| &instrument.instr_type)
{ {
let sample_slot = *instrument let sample_slot = *instrument
.sample_for_note .sample_for_note