Don't crash if a tile does not have enough data for the heuristic

This commit is contained in:
Alexander Bock
2018-11-21 14:47:27 -05:00
parent 1910450419
commit 1bb3c3ee27
@@ -638,7 +638,7 @@ RawTile RawTileDataReader::readTileData(TileIndex tileIndex) const {
for (const MemoryLocation& ml : NoDataAvailableData) {
std::byte* ptr = rawTile.imageData.get();
if (ptr[ml.offset] != ml.value) {
if (ml.offset >= numBytes || ptr[ml.offset] != ml.value) {
// Bail out as early as possible
break;
}