From f5ddffa087d1802ce3faaff8d07401e918802204 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Wed, 9 Aug 2023 10:21:41 +0200 Subject: [PATCH] Fix coverity warning in esm3/globalscript.cpp --- components/esm3/globalscript.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/esm3/globalscript.cpp b/components/esm3/globalscript.cpp index c101d92719..935bf35857 100644 --- a/components/esm3/globalscript.cpp +++ b/components/esm3/globalscript.cpp @@ -19,7 +19,11 @@ namespace ESM mTargetId = esm.getHNORefId("TARG"); if (esm.peekNextSub("FRMR")) mTargetRef = esm.getFormId(true, "FRMR"); - esm.applyContentFileMapping(mTargetRef); + if (!esm.applyContentFileMapping(mTargetRef)) + { + mTargetId = ESM::RefId(); + mTargetRef = ESM::FormId(); + } } void GlobalScript::save(ESMWriter& esm) const