From 33c454e0734d0592eb46ae416c1e775185922dc8 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Sat, 29 Nov 2014 20:39:25 +1100 Subject: [PATCH] Check whether any subrecords remain after skipping moved references. Should resolve bug #2070. --- components/esm/loadcell.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index bbd6696f1..f8966ad20 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -182,6 +182,13 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref, bool& deleted) // That should be it, I haven't seen any other fields yet. } + // If moved references are not handled then it is possible that CellRef::load() can lead + // to strange results because ESMReader::isNextSub("xxx") will always return false when + // there are no more subrecords. When moved references are handled properly by OpenCS + // below 2 lines can be removed. + if (!esm.hasMoreSubs()) + return false; + ref.load (esm); // Identify references belonging to a parent file and adapt the ID accordingly.