From b0ccb9a396be7d73771f4dbe499d851f0e7bf630 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 14 Jul 2015 18:10:31 +0300 Subject: Fix crash if warp to smaller map into tile with height > 0. --- src/resources/map/mapheights.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/map/mapheights.h b/src/resources/map/mapheights.h index c0fb2b6f8..149645b3d 100644 --- a/src/resources/map/mapheights.h +++ b/src/resources/map/mapheights.h @@ -37,7 +37,7 @@ class MapHeights final void setHeight(const int x, const int y, const uint8_t height); uint8_t getHeight(const int x, const int y) const - { return mTiles[x + y * mWidth]; } + { return x < mWidth && y < mHeight ? mTiles[x + y * mWidth] : 0; } private: int mWidth; -- cgit v1.2.3-60-g2f50