From 1bce9d21d72a30cc7a17ae646d8fefd71a37c525 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 2 Sep 2009 12:08:08 +0200 Subject: QCompleter could crash when setting the completion prefix This fixes the autotest that was crashing Task-number: 246056 Reviewed-by: ogoffart --- src/gui/util/qcompleter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 6196f0f..87dab42 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -823,12 +823,11 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted) Q_Q(QCompleter); QString completion; - if (!(index.flags() & Qt::ItemIsEnabled)) - return; - if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) { completion = prefix; } else { + if (!(index.flags() & Qt::ItemIsEnabled)) + return; QModelIndex si = proxy->mapToSource(index); si = si.sibling(si.row(), column); // for clicked() completion = q->pathFromIndex(si); -- cgit v0.12