Add missing init()-if-dirty in two of ICU's QCollator::compare()s

Both delegate to the one that did do the if dirty: init() check, but
only after they've tested whether d->collator is set, which it might
not be when dirty.

Change-Id: I77533d6d32c4a8c9b42797c77003e50f5820775a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2018-07-11 17:51:49 +02:00
parent 23870b3cad
commit 9c0d34da52

View File

@ -116,6 +116,9 @@ int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) con
int QCollator::compare(const QString &s1, const QString &s2) const
{
if (d->dirty)
d->init();
if (d->collator)
return compare(s1.constData(), s1.size(), s2.constData(), s2.size());
@ -124,6 +127,9 @@ int QCollator::compare(const QString &s1, const QString &s2) const
int QCollator::compare(const QStringRef &s1, const QStringRef &s2) const
{
if (d->dirty)
d->init();
if (d->collator)
return compare(s1.constData(), s1.size(), s2.constData(), s2.size());