From 9ef271f1a8b48267a13eabae47b7c7ce90c9e1b5 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Thu, 6 Jul 2023 23:49:16 +0300 Subject: [PATCH] fix(tracker/gioui): display voice states crashed if somehow patch had more than 32 voices --- tracker/gioui/instrumenteditor.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tracker/gioui/instrumenteditor.go b/tracker/gioui/instrumenteditor.go index b84f6f7..5828968 100644 --- a/tracker/gioui/instrumenteditor.go +++ b/tracker/gioui/instrumenteditor.go @@ -276,7 +276,11 @@ func (ie *InstrumentEditor) layoutInstrumentNames(gtx C, t *Tracker) D { label := func(gtx C) D { c := float32(0.0) voice := t.Song().Patch.FirstVoiceForInstrument(i) - for j := 0; j < t.Song().Patch[i].NumVoices; j++ { + loopMax := t.Song().Patch[i].NumVoices + if loopMax > vm.MAX_VOICES { + loopMax = vm.MAX_VOICES + } + for j := 0; j < loopMax; j++ { vc := ie.voiceStates[voice] if c < vc { c = vc