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.

(cherry picked from commit cb0fa0ed7b)
This commit is contained in:
Haoyu Qiu 2023-03-16 15:06:57 +08:00 committed by Yuri Sizov
parent ec5f503289
commit ef06e5d786
1 changed files with 1 additions and 2 deletions

View File

@ -298,8 +298,7 @@ void InspectorDock::_prepare_resource_extra_popup() {
popup->set_item_disabled(popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), r.is_null()); popup->set_item_disabled(popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), r.is_null());
Ref<Resource> current_res = _get_current_resource(); Ref<Resource> 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_null() || current_res->is_built_in());
popup->set_item_disabled(popup->get_item_index(RESOURCE_SHOW_IN_FILESYSTEM), current_res->is_built_in());
} }
Ref<Resource> InspectorDock::_get_current_resource() const { Ref<Resource> InspectorDock::_get_current_resource() const {