diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-05-04 10:46:17 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-05-05 16:28:53 +0200 |
commit | 358df462a03f658277d6ce79d7846d3d53d8d05e (patch) | |
tree | 35897d96990ac4d90ae0eb2a9825ae573f10768c /src/corelib/text/qlocale.cpp | |
parent | 3b155973c494e847b821f0b5675a061f4e424a6c (diff) |
Fix assertion on matchingLocales(Abhkazian, Any, Any)
CLDR v39 has no locales for Abkhazian, so the locale_index[] entry for
it actually indexes the last entry before the next language up the
enum. This has m_language_id less than Abkhazian.
Change-Id: If8b88f30476a981b3ee00ff8760a46ede0b7aab7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/corelib/text/qlocale.cpp')
-rw-r--r-- | src/corelib/text/qlocale.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 8c0ce2434e..50e2b352f4 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -2640,15 +2640,15 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language, QLocale::Scr result.reserve(locale_data_size); quint16 index = locale_index[language]; - Q_ASSERT(filter.acceptLanguage(locale_data[index].m_language_id)); - do { + // There may be no matches, for some languages (e.g. Abkhazian at CLDR v39). + while (filter.acceptLanguage(locale_data[index].m_language_id)) { const QLocaleId id = locale_data[index].id(); if (filter.acceptScriptTerritory(id)) { result.append(QLocale(*(id.language_id == C ? c_private() : new QLocalePrivate(locale_data + index, index)))); } ++index; - } while (filter.acceptLanguage(locale_data[index].m_language_id)); + } return result; } |