Simulator: json.decode() crashes with valid, brief json

Tap the A button to crash the macOS simulator 1.4.0 (120850):

function playdate.update()
	if playdate.buttonJustPressed(playdate.kButtonA) then
		json.decode("[[[[0,1,2,3,4,5,6,7,8,[[[[9]]]]]]]]")
	end
end

This is the minimal case I could find easily. Remove any element from the json-formatted string and the problem will go away.

It doesn’t always crash on the first decode, but will give it up eventually if called repeatedly. It’s a heap corruption error, so the callstack can vary.

Seems to work ok on the hardware but I didn’t test too deeply.

okay, got a fix in for this. It was a heap of awful, one of those “what was I thinking” things where you tear it all up and rebuilt it the obvious way and then discover why it was such a mess in the first place. But it does work now! If this is holding you up let me know and I’ll send you a patched build.

Nice!
I was able to work around it by just rearranging the json file causing the problem. Maybe it’s trashing the heap gently and I’ll find out later, but at least right now it’s not holding me up. Tuck that fix in the next mainline update and I’ll be happy. Thanks!