1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Add two missing Null checks

These Null checks were removed in #10581 but actually changed the
logic of the functions in this case.

This fixes #10654
This commit is contained in:
Hein-Pieter van Braam
2017-08-26 22:53:28 +02:00
parent 53c0010932
commit 3e25cf9e05
2 changed files with 10 additions and 3 deletions

View File

@@ -1546,9 +1546,11 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N
scr = NULL; scr = NULL;
} }
} else { } else {
if (obj) {
on_script = obj->get_script(); on_script = obj->get_script();
} }
} }
}
//print_line("but it has a script?"); //print_line("but it has a script?");
if (!on_script.is_valid() && id.script.is_valid()) { if (!on_script.is_valid() && id.script.is_valid()) {
@@ -2237,9 +2239,11 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
scr = NULL; scr = NULL;
} }
} else { } else {
if (obj) {
on_script = obj->get_script(); on_script = obj->get_script();
} }
} }
}
if (!on_script.is_valid() && t.script.is_valid()) { if (!on_script.is_valid() && t.script.is_valid()) {
on_script = t.script; on_script = t.script;

View File

@@ -1401,8 +1401,11 @@ void SceneTree::_live_edit_create_node_func(const NodePath &p_parent, const Stri
Node *n2 = n->get_node(p_parent); Node *n2 = n->get_node(p_parent);
Node *no = Object::cast_to<Node>(ClassDB::instance(p_type)); Node *no = Object::cast_to<Node>(ClassDB::instance(p_type));
no->set_name(p_name); if (!no) {
continue;
}
no->set_name(p_name);
n2->add_child(no); n2->add_child(no);
} }
} }