summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-19 14:21:20 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-19 21:04:13 +0100
commitcaf97c68afc35a8c9a60dd86bf7df205e635bf53 (patch)
treee5978ef97ac657cc9cf785098185810fedaf87d1 /sw
parent303c1433005044e3a818490d65385febc8eb6030 (diff)
cid#1473777 silence Using invalid iterator
Change-Id: I6fd80c8b5cec6d1d9c398e45cbd30cc65caa23a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112749 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/edit/edfcol.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index ed6e90b12ede..bcff20b8b243 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1946,6 +1946,7 @@ void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
std::vector<svx::ClassificationResult> aResults;
if (!sFieldNames.isEmpty())
{
+ assert(it != aStatements.end() && "can only be non-empty if it was valid");
// Order the fields
sal_Int32 nIndex = 0;
do
@@ -1955,8 +1956,9 @@ void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
break;
const auto it2 = aStatements.find(sCurFieldName);
- const OUString sName = (it2 != aStatements.end() ? it->first : sBlank);
- const OUString sValue = (it2 != aStatements.end() ? it->second : sBlank);
+ bool bStatementFound = it2 != aStatements.end();
+ const OUString sName = bStatementFound ? it->first : sBlank;
+ const OUString sValue = bStatementFound ? it->second : sBlank;
if (aKeyCreator.isMarkingTextKey(sName))
{