From 9c0d34da5267db550eaa1b2cccc5c7bbe2dce527 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 11 Jul 2018 17:51:49 +0200 Subject: [PATCH] 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 --- src/corelib/tools/qcollator_icu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp index ad98a187c5..43bbe0ea79 100644 --- a/src/corelib/tools/qcollator_icu.cpp +++ b/src/corelib/tools/qcollator_icu.cpp @@ -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());