Browse Source

Merge pull request #52156 from V-Sekai/missing_script_variables_fix

Fix crash on scenes with tool scripts and mismatched node types
Hugo Locurcio 4 years ago
parent
commit
39c25d5bf3
1 changed files with 8 additions and 6 deletions
  1. 8 6
      editor/editor_inspector.cpp

+ 8 - 6
editor/editor_inspector.cpp

@@ -2656,13 +2656,15 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li
 	}
 	}
 
 
 	// NodeC -> C props... -> NodeB..C..
 	// NodeC -> C props... -> NodeB..C..
-	r_list.erase(script_variables);
-	List<PropertyInfo>::Element *to_delete = bottom->next();
-	while (to_delete && !(to_delete->get().usage & PROPERTY_USAGE_CATEGORY)) {
-		r_list.erase(to_delete);
-		to_delete = bottom->next();
+	if (script_variables) {
+		r_list.erase(script_variables);
+		List<PropertyInfo>::Element *to_delete = bottom->next();
+		while (to_delete && !(to_delete->get().usage & PROPERTY_USAGE_CATEGORY)) {
+			r_list.erase(to_delete);
+			to_delete = bottom->next();
+		}
+		r_list.erase(bottom);
 	}
 	}
-	r_list.erase(bottom);
 }
 }
 
 
 void EditorInspector::set_restrict_to_basic_settings(bool p_restrict) {
 void EditorInspector::set_restrict_to_basic_settings(bool p_restrict) {