Photoshop should never crash, no matter what a script tries to do. If the script has a problem, like it does something invalid, then Photoshop should display an error, but not crash. Unfortunately such a crash indicates a bug with Photoshop. 🙁
The first step would be to figure out which line in the script is causing Photoshop to crash. I'm afraid doing that gets a bit technical. We'd love to do it for you, but the script doesn't crash for us on a wide variety of Photopshop version. If you'd like to give it a try, you can follow the Debugging
section here:
https://github.com/EsotericSoftware/spine-scripts/tree/master/photoshop#debugging
The idea is that you run the script line-by-line to identify which line is causing Photoshop to crash. If you can let us know what line number is the problem, maybe we can work out a solution. Before you start please ensure you have the latest script (it should have scriptVersion = 5.7
near the top).