diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-01-25 14:13:00 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-01-25 14:17:45 +0200 |
commit | 306b98638e3d8f52ff7bdf639fbd4a478dfc8913 (patch) | |
tree | 098646a97da357d3a1e0350624bd28f95f2e77d6 | |
parent | 37472fa2c0c4c03a62fa6a57b25655c91bd8263f (diff) |
Allow unsetting `shortcut_context`.
-rw-r--r-- | scene/gui/base_button.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index bcb2b0c50e..5f937acb8d 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -382,8 +382,11 @@ Ref<ButtonGroup> BaseButton::get_button_group() const { } void BaseButton::set_shortcut_context(Node *p_node) { - ERR_FAIL_NULL_MSG(p_node, "Shortcut context node can't be null."); - shortcut_context = p_node->get_instance_id(); + if (p_node != nullptr) { + shortcut_context = p_node->get_instance_id(); + } else { + shortcut_context = ObjectID(); + } } Node *BaseButton::get_shortcut_context() const { |