From cb0fa0ed7b6b5e953f820a762979d1d35c12b8ee Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 16 Mar 2023 15:06:57 +0800 Subject: [PATCH] Fix error when opening Inspector's dots menu When the inspector is empty, opening the "extra resource options" menu produces a error: > Condition "current_res.is_null()" is true. Opening the mneu with no current resource is valid use case, so `ERR_FAIL_COND` should not be used. --- editor/inspector_dock.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index ab061c4d5cb..b9efe7d2ea3 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -298,8 +298,7 @@ void InspectorDock::_prepare_resource_extra_popup() { popup->set_item_disabled(popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), r.is_null()); Ref current_res = _get_current_resource(); - ERR_FAIL_COND(current_res.is_null()); - popup->set_item_disabled(popup->get_item_index(RESOURCE_SHOW_IN_FILESYSTEM), current_res->is_built_in()); + popup->set_item_disabled(popup->get_item_index(RESOURCE_SHOW_IN_FILESYSTEM), current_res.is_null() || current_res->is_built_in()); } Ref InspectorDock::_get_current_resource() const {