浏览代码

Merge pull request #42733 from madmiraal/fix-41281

Ensure grid index is valid before trying to change value.
Rémi Verschelde 4 年之前
父节点
当前提交
d18eba4d18
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      editor/editor_properties.cpp

+ 1 - 1
editor/editor_properties.cpp

@@ -614,7 +614,7 @@ public:
 
 
 		const Ref<InputEventMouseButton> mb = p_ev;
 		const Ref<InputEventMouseButton> mb = p_ev;
 
 
-		if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
+		if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed() && hovered_index > 0) {
 			// Toggle the flag.
 			// Toggle the flag.
 			// We base our choice on the hovered flag, so that it always matches the hovered flag.
 			// We base our choice on the hovered flag, so that it always matches the hovered flag.
 			if (value & (1 << hovered_index)) {
 			if (value & (1 << hovered_index)) {