Merge pull request #177 from tidalcycles/soft-errors

fix some annoying bugs
This commit is contained in:
Felix Roos 2022-08-06 23:32:16 +02:00 committed by GitHub
commit 21b2184750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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();
}

View File

@ -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;
};