From c0f71fb65cc97ee19bf986f6ee31f0a2f8fc413f Mon Sep 17 00:00:00 2001 From: pelya Date: Fri, 20 May 2016 23:27:32 +0300 Subject: [PATCH] Fixed a crash in my own tooltip code --- src/misc_gui.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index ad525c843e..6fc4873da6 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -687,11 +687,8 @@ struct TooltipsWindow : public Window // Move it to the top of the screen, away from mouse cursor, so it won't steal screen taps on Android pt.y = GetMainViewTop(); - pt.x = _cursor.pos.x > _screen.width / 2 ? - FindWindowById(WC_MAIN_TOOLBAR, 0)->width : - _screen.width - sm_width - FindWindowById(WC_MAIN_TOOLBAR, 0)->width; - if (_cursor.pos.y > pt.y + GetMinSizing(NWST_STEP)) { - pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width); + if (_cursor.pos.y < pt.y + GetMinSizing(NWST_STEP)) { + pt.x = _cursor.pos.x > _screen.width / 2 ? GetMinSizing(NWST_STEP) : _screen.width - sm_width - GetMinSizing(NWST_STEP); } return pt;