From 6b3c6a773811b1c8c313480467b09500d093cb0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 26 May 2025 21:58:13 +0200 Subject: [PATCH] Use the same error-tolerant approach for lcl data like we use for class data --- src/map/IMG/rgnfile.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index cf339aa8..706aab44 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -605,16 +605,15 @@ bool RGNFile::readLclFields(Handle &hdl, const quint32 flags[3], } else size = m + 1; - if (i == 2 && point) { - if (!readLclNavaid(hdl, size, point)) - return false; - } else if (i == 3 && point) { - if (!readLclImg(hdl, size, point)) - return false; - } else { - if (!seek(hdl, pos(hdl) + size)) - return false; - } + quint32 off = pos(hdl); + + if (i == 2 && point) + readLclNavaid(hdl, size, point); + else if (i == 3 && point) + readLclImg(hdl, size, point); + + if (!seek(hdl, off + size)) + return false; } bitfield >>= 1; j++;