From b864e167281b7ac180ed121126a9accdaa6008d9 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 18 Nov 2013 15:58:30 +0100 Subject: [PATCH] Fix small bug in array sorting Task-number: QTBUG-34321 Change-Id: I33089499f730bce16a9dfdda04cc8402602bc5fa Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4sparsearray.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp index ec6b0f5..3ee89d5 100644 --- a/src/qml/jsruntime/qv4sparsearray.cpp +++ b/src/qml/jsruntime/qv4sparsearray.cpp @@ -57,9 +57,9 @@ bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) co { Scope scope(m_context); - if (p1.value.isUndefined()) + if (p1.value.isUndefined() || p1.value.isEmpty()) return false; - if (p2.value.isUndefined()) + if (p2.value.isUndefined() || p2.value.isEmpty()) return true; ScopedObject o(scope, m_comparefn); if (o) { @@ -71,7 +71,7 @@ bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) co callData->args[1] = p2.value; result = __qmljs_call_value(m_context, m_comparefn, callData); - return result->toNumber() <= 0; + return result->toNumber() < 0; } ScopedString p1s(scope, p1.value.toString(m_context)); ScopedString p2s(scope, p2.value.toString(m_context)); -- 2.7.4