浏览代码

Allow unsetting `shortcut_context`.

bruvzg 3 年之前
父节点
当前提交
306b98638e
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      scene/gui/base_button.cpp

+ 5 - 2
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 {