diff options
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index e4df95716d..743d35fa69 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -1262,13 +1262,9 @@ void Object::arraySort(ExecutionContext *context, ObjectRef thisObject, const Va ArrayElementLessThan lessThan(context, thisObject, comparefn); + if (!len) + return; Property *begin = arrayData; - // We deliberately choose qSort over std::sort here, because with - // MSVC in debug builds, std::sort has an ASSERT() that verifies - // that the return values of lessThan are perfectly consistent - // and aborts otherwise. We do not want JavaScript to easily crash - // the entire application and therefore choose qSort, which doesn't - // have this property. std::sort(begin, begin + len, lessThan); } |