summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-11-11 12:26:44 +0000
committertruelight <truelight@openttd.org>2007-11-11 12:26:44 +0000
commit8725f2b857fc2515b51e980cf74075fb69d08349 (patch)
treea021ed28490d76d095e1ae3f996a51bd9f272ffd /src/window.cpp
parent750114477511cfa2f97b377b52b2140e3f2d207a (diff)
downloadopenttd-8725f2b857fc2515b51e980cf74075fb69d08349.tar.xz
(svn r11405) -Fix: in rare cases OpenTTD could segfault when resizing and scroll the main window (Rafal Rzepecki)
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 44dc9ae2a..f64446c69 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1466,6 +1466,12 @@ static bool HandleViewportScroll()
w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
+ if (!(_right_button_down || scrollwheel_scrolling) || w == NULL) {
+ _cursor.fix_at = false;
+ _scrolling_viewport = false;
+ return true;
+ }
+
if (WP(w, vp_d).follow_vehicle != INVALID_VEHICLE && w == FindWindowById(WC_MAIN_WINDOW, 0)) {
/* If the main window is following a vehicle, then first let go of it! */
const Vehicle *veh = GetVehicle(WP(w, vp_d).follow_vehicle);
@@ -1473,12 +1479,6 @@ static bool HandleViewportScroll()
return true;
}
- if (!(_right_button_down || scrollwheel_scrolling) || w == NULL) {
- _cursor.fix_at = false;
- _scrolling_viewport = false;
- return true;
- }
-
if (_patches.reverse_scroll) {
e.we.scroll.delta.x = -_cursor.delta.x;
e.we.scroll.delta.y = -_cursor.delta.y;