Calling `playdate.sound.synth:setFrequencyMod()` with nil after it previously had a mod causes crashes

So I have a synth. I had set it up with an arpeggio frequency mod like so:

local mod <const> =
mod:setArpeggio(0, obj.effect.note0, obj.effect.note1)

But then later I try to remove that mod, by calling synth:setFrequencyMod(nil), and the Playdate simulator immediately crashes.

	mod->used = 1;

and mod is NULL there. :man_facepalming: This has been in there since Dec. 2017, and pretty much every other modulator setter function does the same thing, too. Oof.

okay, fixed! As a temporary workaround you could use a dummy modulator, like

dummymod =
1 Like