Infinite recursion in plugin crashes XD hard

I’ve seen this before, but just saw it again: if my plugin mistakenly recurses infinitely (a “change all occurrences” gone wrong :wink: ), XD will crash immediately.

Shouldn’t the JS stack be managed like any good interpreter and a standard runtime error be issued?

could you share a small snippet of code that demonstrates this behavior?

Sure, an out-of-control “Change all occurrences” produced this:

const isTextNode = node => isTextNode(node)

and I called it. Boom.

Seems to be crashing at the 512’th recursion depth, a not-unexpected number.

This was called from documentStateChanged in a panel plugin.

XD 24 Crash (36.7 KB)