From c4624639e6c58184ebad49aa2c914612abc1ff9b Mon Sep 17 00:00:00 2001
From: Kahrl <kahrl@gmx.net>
Date: Sat, 13 Dec 2014 00:39:07 +0100
Subject: [PATCH] Fix segfault when dragging mouse out of mainmenu window
 (#1910)

---
 src/guiFormSpecMenu.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index bd4a7c0d5..6ef20cead 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -2772,7 +2772,8 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event)
 		gui::IGUIElement *hovered =
 			Environment->getRootGUIElement()->getElementFromPoint(
 				core::position2d<s32>(x, y));
-		if (hovered->getType() == gui::EGUIET_TAB_CONTROL) {
+		if (hovered && isMyChild(hovered) &&
+				hovered->getType() == gui::EGUIET_TAB_CONTROL) {
 			gui::IGUISkin* skin = Environment->getSkin();
 			assert(skin != NULL);
 			gui::IGUIFont *old_font = skin->getFont();
-- 
GitLab