From 90cbbf7883d97303765bcdd92ca41123ab6bece9 Mon Sep 17 00:00:00 2001 From: Lewis Moten Date: Mon, 6 May 2024 01:48:59 -0400 Subject: [PATCH] skip highlighting channel that doesn't exist --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 3605855..474ba9b 100644 --- a/index.js +++ b/index.js @@ -950,6 +950,7 @@ function drawFrequencyLineGraph(ctx, channel, highLowIndex, color, lineWidth, da const {pairs, time} = frequencyOverTime[i]; const x = getTimeX(time, newest); if(x === -1) continue; + if(channel > pairs.length) continue; const amplitude = pairs[channel][highLowIndex]; const y = getPercentY(amplitude / MAX_DATA); if(i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y);