瀏覽代碼

Fix build error caused by cherry-pick from 3.0

Problematic commit: 5e4f092ac
George Marques 7 年之前
父節點
當前提交
fa000c6327
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      editor/editor_plugin.cpp

+ 3 - 2
editor/editor_plugin.cpp

@@ -176,8 +176,9 @@ void EditorPlugin::make_visible(bool p_visible) {
 void EditorPlugin::edit(Object *p_object) {
 
 	if (get_script_instance() && get_script_instance()->has_method("edit")) {
-		if (p_object->is_class("Resource")) {
-			get_script_instance()->call("edit", Ref<Resource>(Object::cast_to<Resource>(p_object)));
+		Resource *obj = p_object ? p_object->cast_to<Resource>() : NULL;
+		if (obj) {
+			get_script_instance()->call("edit", Ref<Resource>(obj));
 		} else {
 			get_script_instance()->call("edit", p_object);
 		}