From 53182d812225f45e8089947cd5667085565e3321 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 28 Aug 2024 12:13:08 +0100 Subject: [PATCH] It doesn't appear to be an error to have an invalid instrument index --- tracker/agb-xm-core/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tracker/agb-xm-core/src/lib.rs b/tracker/agb-xm-core/src/lib.rs index 7b39c1d4..d2ad32fc 100644 --- a/tracker/agb-xm-core/src/lib.rs +++ b/tracker/agb-xm-core/src/lib.rs @@ -112,8 +112,10 @@ pub fn parse_module(module: &Module) -> agb_tracker_interop::Track { } else { let instrument_index = (slot.instrument - 1) as usize; - if let InstrumentType::Default(ref instrument) = - module.instrument[instrument_index].instr_type + if let Some(InstrumentType::Default(ref instrument)) = module + .instrument + .get(instrument_index) + .map(|instrument| &instrument.instr_type) { let sample_slot = *instrument .sample_for_note