From 6ccb82cf341ed0bf706f5e97bd1843eb3eeac011 Mon Sep 17 00:00:00 2001 From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:41:13 +0100 Subject: [PATCH] fix: handle `script.deckFromGroup(undefined)` gracefully This fixes an exception occuring since #13425 where constructing a `components.JogWheelBasic` with only a `deck` number with a matching `group` would result an exception (since `script.deckFromGroup` would call `substring` on `undefined`). --- res/controllers/common-controller-scripts.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/res/controllers/common-controller-scripts.js b/res/controllers/common-controller-scripts.js index 93c56803ca0..fcdf516a586 100644 --- a/res/controllers/common-controller-scripts.js +++ b/res/controllers/common-controller-scripts.js @@ -248,6 +248,9 @@ script.midiDebug = function(channel, control, value, status, group) { // Returns the deck number of a "ChannelN" or "SamplerN" group script.deckFromGroup = function(group) { let deck = 0; + if (group === undefined) { + return undefined; + } if (group.substring(2, 8) === "hannel") { // Extract deck number from the group text deck = group.substring(8, group.length - 1);