Browse Source

fix Editor Crashes When Middle Mouse Button Is Clicked on Empty Space in scene_tabs

SaNeOr 3 months ago
parent
commit
0785c9ad81
1 changed files with 3 additions and 1 deletions
  1. 3 1
      scene/gui/tab_bar.cpp

+ 3 - 1
scene/gui/tab_bar.cpp

@@ -208,7 +208,9 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
 		}
 
 		if (close_with_middle_mouse && mb->is_pressed() && mb->get_button_index() == MouseButton::MIDDLE) {
-			emit_signal(SNAME("tab_close_pressed"), hover);
+			if (hover != -1) {
+				emit_signal(SNAME("tab_close_pressed"), hover);
+			}
 		}
 
 		if (mb->is_pressed() && (mb->get_button_index() == MouseButton::LEFT || (select_with_rmb && mb->get_button_index() == MouseButton::RIGHT))) {