From 1984ebcf5174e11fb5b128c500d2c10a2e827aca Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 16 Nov 2020 11:29:17 +0100 Subject: 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 Reviewed-by: Orgad Shaneh --- src/plugins/git/gerrit/gerritmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit v1.2.3