sc/source/core/tool/cellkeytranslator.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 47690d9fbeb1e1650145c272972fc92a6e7d01ef
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Feb 2 19:27:45 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Feb 2 17:28:06 2025 +0100

    The first entry must not be the default best match
    
    This is based on code reading; I see no reason to assume that the
    front has the best match, that should be used when the following
    iterations didn't choose it explicitly.
    
    Change-Id: I2f90e56d00c25737c58e1e90642618a88f1fa2ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181011
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/tool/cellkeytranslator.cxx 
b/sc/source/core/tool/cellkeytranslator.cxx
index 30f46444eff3..6183ab9f85c7 100644
--- a/sc/source/core/tool/cellkeytranslator.cxx
+++ b/sc/source/core/tool/cellkeytranslator.cxx
@@ -98,7 +98,7 @@ static void lclMatchKeyword(OUString& rName, const 
ScCellKeywordHashMap& aMap,
     }
 
     LanguageTag aLanguageTag( pLocale ? *pLocale : 
lang::Locale(u""_ustr,u""_ustr,u""_ustr));
-    const char* aBestMatchName = itr->second.front().mpName;
+    const char* aBestMatchName = nullptr;
     LocaleMatch eLocaleMatchLevel = LOCALE_MATCH_NONE;
     bool bOpCodeMatched = false;
 
@@ -156,7 +156,8 @@ static void lclMatchKeyword(OUString& rName, const 
ScCellKeywordHashMap& aMap,
     }
 
     // No preferred strings found.  Return the best matching name.
-    rName = OUString::createFromAscii(aBestMatchName);
+    if (aBestMatchName)
+        rName = OUString::createFromAscii(aBestMatchName);
 }
 
 void ScCellKeywordTranslator::transKeyword(OUString& rName, const 
lang::Locale* pLocale, OpCode eOpCode)

Reply via email to