updateSystemPrivate(): fix handling of empty string as non-null QVariant
QSystemLocale::query() can return an empty string for PositiveSign on Windows, apparently. In any case, we shouldn't be taking .at(0) of a QString without checking it's non-empty. Fixes: QTBUG-81530 Change-Id: I4d496a2650362f225d02998bd7b8be9fd783edb4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
e83c4e8138
commit
ca85e1246e
@ -734,23 +734,23 @@ static void updateSystemPrivate()
|
||||
globalLocaleData.m_script_id = res.toInt();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_decimal = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_group = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_zero = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::NegativeSign, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_minus = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_plus = res.toString().at(0).unicode();
|
||||
}
|
||||
#endif // !QT_NO_SYSTEMLOCALE
|
||||
|
Loading…
Reference in New Issue
Block a user