mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
GDScript Check for null list in for loop
This commit is contained in:
parent
90f8eb7aa0
commit
dc046e5cbe
2 changed files with 8 additions and 2 deletions
|
|
@ -1198,7 +1198,7 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) {
|
|||
variable_type.kind = GDScriptParser::DataType::BUILTIN;
|
||||
variable_type.builtin_type = Variant::INT; // Can this ever be a float or something else?
|
||||
p_for->variable->set_datatype(variable_type);
|
||||
} else {
|
||||
} else if (p_for->list) {
|
||||
resolve_node(p_for->list);
|
||||
if (p_for->list->datatype.has_container_element_type()) {
|
||||
variable_type = p_for->list->datatype.get_container_element_type();
|
||||
|
|
@ -1213,7 +1213,9 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) {
|
|||
variable_type.kind = GDScriptParser::DataType::VARIANT;
|
||||
}
|
||||
}
|
||||
p_for->variable->set_datatype(variable_type);
|
||||
if (p_for->variable) {
|
||||
p_for->variable->set_datatype(variable_type);
|
||||
}
|
||||
|
||||
resolve_suite(p_for->loop);
|
||||
p_for->set_datatype(p_for->loop->get_datatype());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue