From ba16fd8e741e85e3472b7425e25986ebfe4901a8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 8 Dec 2024 19:43:46 +0200 Subject: [PATCH] no need to do repeated lookups here Change-Id: Iec30aa6bbd1bcb8bb22cfb002f81ea04458755b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178116 Reviewed-by: Noel Grandin Tested-by: Jenkins --- sw/source/core/text/inftxt.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index f2cbbba03376..cbdccecb9ff0 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1357,12 +1357,14 @@ void SwTextPaintInfo::DrawCSDFHighlighting(const SwLinePortion &rPor) const OUString sCharStyleDisplayName; sCharStyleDisplayName = SwStyleNameMapper::GetUIName(sCurrentCharStyle, SwGetPoolIdFromName::ChrFmt); - if (!sCharStyleDisplayName.isEmpty() - && rCharStylesColorMap.find(sCharStyleDisplayName) - != rCharStylesColorMap.end()) + if (!sCharStyleDisplayName.isEmpty()) { - aFillColor = rCharStylesColorMap[sCharStyleDisplayName].first; - sCSNumberOrDF = OUString::number(rCharStylesColorMap[sCharStyleDisplayName].second); + auto it = rCharStylesColorMap.find(sCharStyleDisplayName); + if (it != rCharStylesColorMap.end()) + { + aFillColor = it->second.first; + sCSNumberOrDF = OUString::number(it->second.second); + } } } }