From f20334ff7432717144650764ee55739e7c987fce Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 17 Mar 2024 03:19:07 -0500 Subject: [PATCH] low quality code detected see that's why we have quality control and not accept pull requests in one second --- src/engine/fileOps/ftm.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/engine/fileOps/ftm.cpp b/src/engine/fileOps/ftm.cpp index a6ef42370..781a1be17 100644 --- a/src/engine/fileOps/ftm.cpp +++ b/src/engine/fileOps/ftm.cpp @@ -2141,13 +2141,17 @@ bool DivEngine::loadFTM(unsigned char* file, size_t len, bool dnft, bool dnft_si } } + ds.insLen = ds.ins.size(); + if (ds.insLen > 0) { for (int tries = 0; tries < 5; tries++) // de-duplicating instruments { for (int i = 0; i < 128; i++) { + if (ds.ins.empty()) break; int index = i >= (int)ds.insLen ? ((int)ds.insLen - 1) : i; if (index < 0) index = 0; + DivInstrument* ins = ds.ins[index]; if (ins->type == DIV_INS_FM) {