[Libreoffice-commits] core.git: i18nlangtag/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 3 19:29:22 UTC 2020
i18nlangtag/source/languagetag/languagetag.cxx | 46 ++++++++++++++-----------
1 file changed, 27 insertions(+), 19 deletions(-)
New commits:
commit 004ad8805429930ca6aa122b3c38c496ce849e61
Author: Noel Grandin <noel at peralex.com>
AuthorDate: Thu Dec 3 14:58:29 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Dec 3 20:28:39 2020 +0100
fix assert message inside liblangtag
lt-string.c: line 189: assertion `string != ((void *)0)' failed
Change-Id: I64d3374de57637fa61ac0148f7e82bd37c285a06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107160
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index b9b6cc20a2d8..2f77ee148f71 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -1220,30 +1220,38 @@ bool LanguageTagImpl::canonicalize()
if (!lt_tag_parse_disabled && lt_tag_parse(mpImplLangtag, OUStringToOString(maBcp47, RTL_TEXTENCODING_UTF8).getStr(), &aError.p))
{
- char* pTag = lt_tag_canonicalize( mpImplLangtag, &aError.p);
- SAL_WARN_IF( !pTag, "i18nlangtag", "LanguageTagImpl::canonicalize: could not canonicalize '" << maBcp47 << "'");
- if (pTag)
+ if (aError.p)
+ {
+ SAL_WARN("i18nlangtag", "LanguageTagImpl::canonicalize: could not parse '" << maBcp47 << "'");
+ }
+ else
{
- OUString aNew( OUString::createFromAscii( pTag));
- // Make the lt_tag_t follow the new string if different, which
- // removes default script and such.
- if (maBcp47 != aNew)
+ char* pTag = lt_tag_canonicalize(mpImplLangtag, &aError.p);
+ SAL_WARN_IF(!pTag, "i18nlangtag", "LanguageTagImpl::canonicalize: could not canonicalize '" << maBcp47 << "'");
+ if (pTag)
{
- maBcp47 = aNew;
- bChanged = true;
- meIsIsoLocale = DECISION_DONTKNOW;
- meIsIsoODF = DECISION_DONTKNOW;
- if (!lt_tag_parse( mpImplLangtag, pTag, &aError.p))
+ OUString aNew(OUString::createFromAscii(pTag));
+ // Make the lt_tag_t follow the new string if different, which
+ // removes default script and such.
+ if (maBcp47 != aNew)
{
- SAL_WARN( "i18nlangtag", "LanguageTagImpl::canonicalize: could not reparse '" << maBcp47 << "'");
- free( pTag);
- meIsValid = DECISION_NO;
- return bChanged;
+ maBcp47 = aNew;
+ bChanged = true;
+ meIsIsoLocale = DECISION_DONTKNOW;
+ meIsIsoODF = DECISION_DONTKNOW;
+ if (!lt_tag_parse(mpImplLangtag, pTag, &aError.p))
+ {
+ SAL_WARN("i18nlangtag", "LanguageTagImpl::canonicalize: could not reparse '"
+ << maBcp47 << "'");
+ free(pTag);
+ meIsValid = DECISION_NO;
+ return bChanged;
+ }
}
+ free(pTag);
+ meIsValid = DECISION_YES;
+ return bChanged;
}
- free( pTag);
- meIsValid = DECISION_YES;
- return bChanged;
}
}
else
More information about the Libreoffice-commits
mailing list