summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2020-10-23 01:35:41 +0300
committerAndras Timar <andras.timar@collabora.com>2020-10-23 12:41:28 +0200
commit1c44b8d103dca932b893fbf1dcdff0650ea91e1b (patch)
tree475c5584e81cab191e8ef25990c20080e266dc1b
parentebd3d84ad58b31d325dbe17c35759d12ed7a4242 (diff)
Prevent crash with invalid lang tag.
Change-Id: I778b5b007d4edce946e8b4c26e5a07f12103a968 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104673 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit fb8286255ff8d9872156a73dc0cf32ab04bf8f2a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104678
-rw-r--r--desktop/source/lib/init.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 89cf49dbf6f7..2f0092177d25 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2192,8 +2192,9 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
// not pass it as a parameter to the filter
OUString aOptions = getUString(pOptions);
const OUString aLanguage = extractParameter(aOptions, "Language");
+ bool isValidLangTag = LanguageTag::isValidBcp47(aLanguage, nullptr);
- if (!aLanguage.isEmpty())
+ if (!aLanguage.isEmpty() && isValidLangTag)
{
SfxLokHelper::setDefaultLanguage(aLanguage);
// Set the LOK language tag, used for dialog tunneling.