From 4e4ee1619ce5484f3539be9616ed48bb4af17f2c Mon Sep 17 00:00:00 2001 From: dfeneyrou Date: Wed, 18 Aug 2021 21:11:29 +0300 Subject: [PATCH] fix #20 : the sorting function was not following the strict weak ordering relationship, in particular comp(a,a)=false This was leading to a crash probably due to some duplicated items by the sorting algo (thanks @jceipek for pointing this) --- server/viewer/vwFileDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/viewer/vwFileDialog.cpp b/server/viewer/vwFileDialog.cpp index b88691a..5ad035e 100644 --- a/server/viewer/vwFileDialog.cpp +++ b/server/viewer/vwFileDialog.cpp @@ -115,7 +115,7 @@ vwFileDialog::draw(int fontSize) // Sort folders std::sort(_dirEntries.begin(), _dirEntries.end(), - [](const Entry& a, const Entry& b)->bool { return strcasecmp(a.name.toChar(), b.name.toChar())<=0; } ); + [](const Entry& a, const Entry& b)->bool { return strcasecmp(a.name.toChar(), b.name.toChar())<0; } ); forceFileSorting = true; _isEntriesDirty = false; }