Parcourir la source

Merge pull request #101632 from bruvzg/gds_tween_property_crash

Fix GDScript editor crash on invalid `tween_property` arguments.
Thaddeus Crews il y a 6 mois
Parent
commit
9630d4e2fc
1 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. 8 0
      modules/gdscript/gdscript_editor.cpp

+ 8 - 0
modules/gdscript/gdscript_editor.cpp

@@ -2860,7 +2860,15 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
 
 				if (p_argidx == 1 && p_context.node && p_context.node->type == GDScriptParser::Node::CALL && ClassDB::is_parent_class(class_name, SNAME("Tween")) && p_method == SNAME("tween_property")) {
 					// Get tweened objects properties.
+					if (static_cast<GDScriptParser::CallNode *>(p_context.node)->arguments.is_empty()) {
+						base_type.kind = GDScriptParser::DataType::UNRESOLVED;
+						break;
+					}
 					GDScriptParser::ExpressionNode *tweened_object = static_cast<GDScriptParser::CallNode *>(p_context.node)->arguments[0];
+					if (!tweened_object) {
+						base_type.kind = GDScriptParser::DataType::UNRESOLVED;
+						break;
+					}
 					StringName native_type = tweened_object->datatype.native_type;
 					switch (tweened_object->datatype.kind) {
 						case GDScriptParser::DataType::SCRIPT: {