Merge pull request #2507 from hariseldon78/patch-1

Update workspaces.cpp
This commit is contained in:
Alexis Rouillard 2023-09-13 18:21:22 +02:00 committed by GitHub
commit 4d32991bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -439,7 +439,6 @@ void Workspaces::sort_workspaces() {
// Helper comparisons
auto is_id_less = a->id() < b->id();
auto is_name_less = a->name() < b->name();
auto is_number_less = std::stoi(a->name()) < std::stoi(b->name());
switch (sort_by_) {
case SORT_METHOD::ID:
@ -448,7 +447,7 @@ void Workspaces::sort_workspaces() {
return is_name_less;
case SORT_METHOD::NUMBER:
try {
return is_number_less;
return std::stoi(a->name()) < std::stoi(b->name());
} catch (const std::invalid_argument &) {
// Handle the exception if necessary.
break;