summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-15 13:50:49 +0000
committerrubidium <rubidium@openttd.org>2009-11-15 13:50:49 +0000
commit5fe405bad114ada019616cda4caf0cf9f8886db9 (patch)
treee6fbe646eb6a89803db9b1b80da8cffb9c4f905a /src/window.cpp
parentaeb9f8e715c1a11c926d13eaf8cd39b0d0caa3fd (diff)
downloadopenttd-5fe405bad114ada019616cda4caf0cf9f8886db9.tar.xz
(svn r18093) -Fix: the mouseover handler could crash if there wasn't a widget under the mouse
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/window.cpp b/src/window.cpp
index caf9f2840..224031a2e 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1333,8 +1333,8 @@ static bool HandleMouseOver()
if (w != NULL) {
/* send an event in client coordinates. */
Point pt = { _cursor.pos.x - w->left, _cursor.pos.y - w->top };
- int widget = w->nested_root->GetWidgetFromPos(pt.x, pt.y)->index;
- w->OnMouseOver(pt, widget);
+ const NWidgetCore *widget = w->nested_root->GetWidgetFromPos(pt.x, pt.y);
+ if (widget != NULL) w->OnMouseOver(pt, widget->index);
}
/* Mouseover never stops execution */