From 946f30f696600b9eac671bb800dd589f521c07a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 9 Feb 2021 20:06:11 +0100 Subject: [PATCH] A little bit more sane feature check --- src/map/IMG/lblfile.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/map/IMG/lblfile.cpp b/src/map/IMG/lblfile.cpp index 98a7f3d1..14f21e18 100644 --- a/src/map/IMG/lblfile.cpp +++ b/src/map/IMG/lblfile.cpp @@ -100,17 +100,19 @@ bool LBLFile::load(Handle &hdl, const RGNFile *rgn, Handle &rgnHdl) && readUInt32(hdl, flags) && readUInt32(hdl, _imgOffset) && readUInt32(hdl, _imgSize))) return false; - quint32 count = size ? size / recordSize : 0; - quint32 maxId = count - 1; - _imgOffsetIdSize = 0; - do { - _imgOffsetIdSize++; - maxId = maxId >> 8; - } while (maxId != 0); + if (size && recordSize) { + quint32 count = size / recordSize; + quint32 maxId = count - 1; + _imgOffsetIdSize = 0; + do { + _imgOffsetIdSize++; + maxId = maxId >> 8; + } while (maxId != 0); - if (!loadFiles(hdl, count, offset, recordSize)) - return false; + if (!loadFiles(hdl, count, offset, recordSize)) + return false; + } } if (_encoding == 11) {