You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found this issue while working on an EditorInspectorPlugin to help with my development. I accidentally didn't initialize a static array that was expected and that caused the entire editor to crash when loading my project.
8/9 is the _parse_property() override I wrote, but the crash happens on size() because the array was never initialized.
This script is where it went wrong. What should happen is the script fails to load (like when it's not static), not the entire editor crashes on load.
Even though there is a null check, Collectables.collectables here is null because the script that's supposed to initialize it is an import script, which doesn't run if the asset is already imported. That's my mistake, but that shouldn't crash the editor. Somehow the null check passes, but it IS null, and when indexing it, it crashes getting the size. Collectable.collectables is marked static in the class, this matters. It is just a PackedStringArray on a Resource.
Okay, this is the same as #87678. It crashes because the inspector.gd is not marked as @tool so it's not being initialized in the editor.
Oh, ok, but then, note that in the documentation the example inspector plugin does not use @tool. Maybe that should be changed or warned about on the guide.
Tested versions
Using version v4.3.dev.custom_build [89850d5] from the git build. Built on linux for linux.
System information
Godot v4.3.dev (89850d5) - Debian GNU/Linux trixie/sid trixie - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (nvidia) - AMD Ryzen 5 1600 Six-Core Processor (12 Threads)
Issue description
Found this issue while working on an EditorInspectorPlugin to help with my development. I accidentally didn't initialize a static array that was expected and that caused the entire editor to crash when loading my project.
8/9 is the
_parse_property()
override I wrote, but the crash happens onsize()
because the array was never initialized.Steps to reproduce
This script is where it went wrong. What should happen is the script fails to load (like when it's not static), not the entire editor crashes on load.
Even though there is a null check,
Collectables.collectables
here is null because the script that's supposed to initialize it is an import script, which doesn't run if the asset is already imported. That's my mistake, but that shouldn't crash the editor. Somehow the null check passes, but it IS null, and when indexing it, it crashes getting the size.Collectable.collectables
is marked static in the class, this matters. It is just a PackedStringArray on a Resource.The MRP is clearer as the requirements to crash are simple, but my project code is way larger.
Minimal reproduction project (MRP)
crash.zip
The text was updated successfully, but these errors were encountered: