diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 84441a1b7..48e52643a 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -1294,8 +1294,8 @@ export function slowcatPrime(...pats) { pats = pats.map(reify); const query = function (state) { const pat_n = Math.floor(state.span.begin) % pats.length; - const pat = pats[pat_n]; - return pat.query(state); + const pat = pats[pat_n]; // can be undefined for same cases e.g. /#cHVyZSg0MikKICAuZXZlcnkoMyxhZGQoNykpCiAgLmxhdGUoLjUp + return pat?.query(state) || []; }; return new Pattern(query)._splitQueries(); } diff --git a/packages/core/util.mjs b/packages/core/util.mjs index 6a96be877..86d798d6c 100644 --- a/packages/core/util.mjs +++ b/packages/core/util.mjs @@ -53,8 +53,8 @@ export const getPlayableNoteValue = (hap) => { // if value is number => interpret as midi number as long as its not marked as frequency if (typeof note === 'number' && context.type !== 'frequency') { note = fromMidi(hap.value); - } else if (typeof note === 'string' && !isNote(note)) { - throw new Error('not a note: ' + note); + } else if (typeof note !== 'string' || !isNote(note)) { + throw new Error('not a note: ' + JSON.stringify(note)); } return note; };