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
Windows 11 - Godot 4.2.dev3.mono, Vulkan API 1.3.242 - Forward+ dedicated NVIDIA
Issue description
Adding a new built-in script to a node and while defining new variables in the script before saving the scene or the node/script, Godot will freeze momentarily after a couple of seconds then exit with the error:
ERROR: FATAL: Index p_index = 0 is out of bounds (size() = 0).
at: operator[] (./core/templates/list.h:521)
If the scene was saved before editing the script Godot does not crash.
If I edit the script anywhere other than the area for defining variables after the extends xxx and before the func _ready(), Godot does not crash whether the scene was saved or not.
Defining any kind of variable, whether @export, const, or var causes the crash.
If a normal (not built-in) script was added, Godot does not crash, whether the script was saved before editing or not.
Steps to reproduce
Create a new scene.
Add a new script to the root node, either from the "Attach new script" button in the scene hierarchy, or by choosing "New Script" from the drop-down in front of "Script" in the inspector under "Node" section.
Check the "Built-in Script" option and click the "Create" button. Giving a name has no change on the crash behavior.
Try adding a new variable definition after the extends line.
Godot will crash while typing the variable definition line.
Minimal reproduction project
Unable to provide one, since Godot crashes because the scene and script crashes before they can be saved. The steps to reproduce the crash are already trivial and don't require much setting up.
The text was updated successfully, but these errors were encountered:
I can reproduce this bug by typing the following code after the extends line. And wait for a very short time it wll crash.
var s = 2
var s = "string"
But with only one line of var definition, I can not reproduce the bug.
For the situation I memtioned, I believe the error comes from here in script_text_editor.cpp:
for (List<ScriptLanguage::ScriptError>::Element *E = errors.front(); E; E = E->next()) {
if (E->get().path.is_empty() || E->get().path != script->get_path()) {
depended_errors[E->get().path].push_back(E->get());
E->erase();
}
}
String error_text = vformat(TTR("Error at (%d, %d):"), errors[0].line, errors[0].column) + " " + errors[0].message;
If all the error doesn't have a path, all elements in errors will be erased, so using errors[0] will crash. But anyway the path is empty doesn't necessary mean it's a depended error.
If I use an @export var ... line, only 1 line is sufficient to trigger the crash after a couple of seconds from the start of typing. Not sure how this might make things clearer, but that's what happens with me. One @export var ... line is sufficient to trigger a crash, unless the scene is saved.
@mirage3d It's the same case. Only type @export var t will crash because this is not a valid statement and have syntax error. If have syntax error and have a unsaved scene, the editor will crash.
Godot version
v4.2.dev3.mono.official [013e8e3]
System information
Windows 11 - Godot 4.2.dev3.mono, Vulkan API 1.3.242 - Forward+ dedicated NVIDIA
Issue description
Adding a new built-in script to a node and while defining new variables in the script before saving the scene or the node/script, Godot will freeze momentarily after a couple of seconds then exit with the error:
ERROR: FATAL: Index p_index = 0 is out of bounds (size() = 0).
at: operator[] (./core/templates/list.h:521)
If the scene was saved before editing the script Godot does not crash.
If I edit the script anywhere other than the area for defining variables after the
extends xxx
and before thefunc _ready()
, Godot does not crash whether the scene was saved or not.Defining any kind of variable, whether
@export
,const
, orvar
causes the crash.If a normal (not built-in) script was added, Godot does not crash, whether the script was saved before editing or not.
Steps to reproduce
extends
line.Minimal reproduction project
Unable to provide one, since Godot crashes because the scene and script crashes before they can be saved. The steps to reproduce the crash are already trivial and don't require much setting up.
The text was updated successfully, but these errors were encountered: