From fc28eefaed2c71a824677b613f87dc4ceaea243b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 2 Feb 2017 19:22:45 +0300 Subject: Fix nullpointer access in special layer draw function. --- src/resources/map/maplayer_unittest.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/resources/map/maplayer_unittest.cc') diff --git a/src/resources/map/maplayer_unittest.cc b/src/resources/map/maplayer_unittest.cc index 103d019cd..bd58d998c 100644 --- a/src/resources/map/maplayer_unittest.cc +++ b/src/resources/map/maplayer_unittest.cc @@ -2117,8 +2117,14 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)") layer->setTempLayer(map->getTempLayer()); TileInfo *const tiles = layer->getTiles(); specialLayer = map->getTempLayer(); + const int *const cache = specialLayer->getCache(); + REQUIRE(cache[0] == 10000); + REQUIRE(cache[1] == 10000); + specialLayer->setTile(1, 0, MapItemType::ARROW_UP); specialLayer->updateCache(); + REQUIRE(cache[0] == 0); + REQUIRE(cache[1] == 10000); layer->drawSpecialLayer(mock, 0, -- cgit v1.2.3-70-g09d2