Skip to content

Commit

Permalink
fix: handle script.deckFromGroup(undefined) gracefully
Browse files Browse the repository at this point in the history
This fixes an exception occuring since mixxxdj#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`).
  • Loading branch information
Swiftb0y committed Jan 2, 2025
1 parent 436aa3c commit 6ccb82c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions res/controllers/common-controller-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6ccb82c

Please sign in to comment.