diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-11-20 09:55:54 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-20 10:06:18 +0100 |
commit | 91364ea88a79ef1dce9dd698285e10d268af1ffe (patch) | |
tree | f3709dc4d4190600327c25ae0f098f3c05932750 /src/qml/qml/qqmlimport.cpp | |
parent | 6d4d98bc593289d4418a1ab83f00dca0608da23e (diff) |
Check that the pathlist is not empty before calling sort() on it
Try to fix QTBUG-34834, where the app crashes because we replaced
qSort with std::sort(). Apparently std::sort always dereferences
begin(), even if it is the same as end().
Task-number: QTBUG-34834
Change-Id: I6207a27f61f21265dd964d7f4a6b78d059c615c8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index f33fd97c16..30b5abb383 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1023,7 +1023,8 @@ QString QQmlImportsPrivate::resolvedUri(const QString &dir_arg, QQmlImportDataba dir.chop(1); QStringList paths = database->fileImportPath; - std::sort(paths.begin(), paths.end(), I::greaterThan); // Ensure subdirs preceed their parents. + if (!paths.isEmpty()) + std::sort(paths.begin(), paths.end(), I::greaterThan); // Ensure subdirs preceed their parents. QString stableRelativePath = dir; foreach(const QString &path, paths) { |