summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2020-06-19 11:05:36 +0200
committerAndras Timar <andras.timar@collabora.com>2020-06-22 08:59:56 +0200
commite428ca117b0510ac7b0fbbf233bd940c8cc464fd (patch)
treea720d80a4a332eba01d166d1ce5c2e2109989f78 /i18npool
parentacba2dd40d8c72be160ad4d4b1424eadab66362b (diff)
Fix a chrash in LOKit (Japanese-only)
Change-Id: I09c8d3a129c0d1d2fab561add0447869156b193f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96682 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/collator/collator_unicode.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx
index 7530e5d2f6f1..5fb6805d8550 100644
--- a/i18npool/source/collator/collator_unicode.cxx
+++ b/i18npool/source/collator/collator_unicode.cxx
@@ -394,6 +394,11 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale),
"", rAlgorithm.isEmpty() ? OUString("") : "collation=" + rAlgorithm));
+ // FIXME: apparently we get here in LOKit case only. When the language is Japanese, we pass "ja@collation=phonetic (alphanumeric first)" to ICU
+ // and ICU does not like this (U_ILLEGAL_ARGUMENT_ERROR). Subsequently LOKit crashes, because collator is nullptr.
+ if (!strcmp(icuLocale.getLanguage(), "ja"))
+ icuLocale = icu::Locale::getJapanese();
+
// load ICU collator
collator.reset( static_cast<icu::RuleBasedCollator*>( icu::Collator::createInstance(icuLocale, status) ) );
if (! U_SUCCESS(status)) {