From abb120b439925ea672f9f02e682d136ab0f93bc0 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Tue, 27 Apr 2021 14:57:07 +0200 Subject: [PATCH] Don't log a warning for reading to the end of the subrecord --- components/esm/loadscpt.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/components/esm/loadscpt.cpp b/components/esm/loadscpt.cpp index 04738b64e..1ad90dbc3 100644 --- a/components/esm/loadscpt.cpp +++ b/components/esm/loadscpt.cpp @@ -61,15 +61,18 @@ namespace ESM str += mVarNames[i].size() + 1; if (str >= tmpEnd) { - // SCVR subrecord is unused and variable names are determined - // from the script source, so an overflow is not fatal. - std::stringstream ss; - ss << "String table overflow"; - ss << "\n File: " << esm.getName(); - ss << "\n Record: " << esm.getContext().recName.toString(); - ss << "\n Subrecord: " << "SCVR"; - ss << "\n Offset: 0x" << std::hex << esm.getFileOffset(); - Log(Debug::Verbose) << ss.str(); + if(str > tmpEnd) + { + // SCVR subrecord is unused and variable names are determined + // from the script source, so an overflow is not fatal. + std::stringstream ss; + ss << "String table overflow"; + ss << "\n File: " << esm.getName(); + ss << "\n Record: " << esm.getContext().recName.toString(); + ss << "\n Subrecord: " << "SCVR"; + ss << "\n Offset: 0x" << std::hex << esm.getFileOffset(); + Log(Debug::Verbose) << ss.str(); + } // Get rid of empty strings in the list. mVarNames.resize(i+1); break;