mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
fix sort crash
This commit is contained in:
@@ -618,7 +618,13 @@ void SelectionTab::sort()
|
||||
if(!sortModeAscending)
|
||||
{
|
||||
if(firstMapIndex)
|
||||
std::reverse(std::next(curItems.begin(), boost::starts_with(curItems[0]->folderName, "..") ? 1 : 0), std::next(curItems.begin(), firstMapIndex - 1));
|
||||
{
|
||||
auto startIt = std::next(curItems.begin(), boost::starts_with(curItems[0]->folderName, "..") ? 1 : 0);
|
||||
auto endIt = std::next(curItems.begin(), firstMapIndex - 1);
|
||||
if(startIt > endIt)
|
||||
std::swap(startIt, endIt);
|
||||
std::reverse(startIt, endIt);
|
||||
}
|
||||
std::reverse(std::next(curItems.begin(), firstMapIndex), curItems.end());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user