utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
576 stars 39 forks source link

Rework ScriptInstance management #528

Closed CedNaru closed 9 months ago

CedNaru commented 10 months ago

Fix #527 When in editor, all scripts in a scene are placeholders (except if a script is in Tool mode, which we don't support) The code responsible from creating the placeholder was trying to refresh the script default values each time it was called, leading to the use of a null pointer when the KotlinScript didn't have any associated KtClass (as it's the case of any newly created script or project that hasn't built the .jar).

I made the code more robust with the following changes:

This PR doesn't solve the issues with the Create/Attach Script UI, but it should prevent a number of crashes caused by it.