summaryrefslogtreecommitdiff
path: root/i18npool/source
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-07-23 13:46:23 +0200
commit082a6eb7f26f684020e8e086fd4c2fea28c49b3a (patch)
treefa9e1e825613ce597a6ad4f7008529204e6f32a2 /i18npool/source
parent15d4c885d471dfd4f09c02f4b4f3b6f0670d46ff (diff)
tdf#132082 Fix a crash in LOKit (Japanese-only)
Change-Id: I09c8d3a129c0d1d2fab561add0447869156b193f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96693 Tested-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'i18npool/source')
-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 b046546ad12f..39037cf2e77b 100644
--- a/i18npool/source/collator/collator_unicode.cxx
+++ b/i18npool/source/collator/collator_unicode.cxx
@@ -395,6 +395,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)) {