From cb7f855fd8aecdc70dcdacd60fff05f47c649c63 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 31 Jan 2013 13:39:16 -0200 Subject: [PATCH] Fix minimap crash --- src/client/minimap.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 84180345..426022f2 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -95,10 +95,8 @@ void Minimap::clean() void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scale) { - if(screenRect.isEmpty()) - return; - if(MMBLOCK_SIZE*scale <= 1) - return; + if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition()) + return ; Rect mapRect = calcMapRect(screenRect, mapCenter, scale); g_painter->saveState(); @@ -142,9 +140,7 @@ void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scal Point Minimap::getPoint(const Position& pos, const Rect& screenRect, const Position& mapCenter, float scale) { - if(screenRect.isEmpty()) - return Point(-1,-1); - if(MMBLOCK_SIZE*scale <= 1) + if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition()) return Point(-1,-1); Rect mapRect = calcMapRect(screenRect, mapCenter, scale); @@ -155,9 +151,7 @@ Point Minimap::getPoint(const Position& pos, const Rect& screenRect, const Posit Position Minimap::getPosition(const Point& point, const Rect& screenRect, const Position& mapCenter, float scale) { - if(screenRect.isEmpty()) - return Position(); - if(MMBLOCK_SIZE*scale <= 1) + if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition()) return Position(); Rect mapRect = calcMapRect(screenRect, mapCenter, scale);