diff options
author | David Schulz <david.schulz@qt.io> | 2020-11-16 11:29:17 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2020-11-16 14:00:05 +0000 |
commit | 1984ebcf5174e11fb5b128c500d2c10a2e827aca (patch) | |
tree | 09c4e287fc6cee2855182da44c4c50bc73e03fd8 /src | |
parent | 92667c779cc5cc64542fb86f3c61f0db552c62b9 (diff) |
Git: fix assert when comparing GerritApproval
When compiling a debug msvc build std::stable_sort verifies that the
compare function returns the inverted result when switching the left
hand side with the right hand side argument.
Change-Id: I34549d69144966c1b74f368e9af35ec565dc791e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/git/gerrit/gerritmodel.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp index ee60343f13..9f3a1014b6 100644 --- a/src/plugins/git/gerrit/gerritmodel.cpp +++ b/src/plugins/git/gerrit/gerritmodel.cpp @@ -67,7 +67,8 @@ QDebug operator<<(QDebug d, const GerritApproval &a) // Sort approvals by type and reviewer bool gerritApprovalLessThan(const GerritApproval &a1, const GerritApproval &a2) { - return a1.type.compare(a2.type) < 0 || a1.reviewer.fullName.compare(a2.reviewer.fullName) < 0; + const int compare = a1.type.compare(a2.type); + return compare == 0 ? a1.reviewer.fullName.compare(a2.reviewer.fullName) < 0 : compare < 0; } QDebug operator<<(QDebug d, const GerritPatchSet &p) |