Thank you for the follow-up. While I fixed the specific line the caused the crash for you, there were other cases where I needed to perform validity checks, which is likely why it continued to crash, apologies.
I am performing a review of my code to try and add any missing validity checks - found a few so far.
Additionally, I believe I have been able to reproduce the over-spawning you were experiencing with the same settings as those you provided. Trying to work out why exactly, but it appears that when the unit group forms, it starts cloning, and doesn't stop until it hits the configured maximum limit - hence the extreme lag and massive wave of enemies.
Hoping to have both figured out/fixed some time today.
Apologies again for the issues. Thank you for reporting them!