TitleManager: Fix crash when sorting by format (#1113)

This commit is contained in:
goeiecool9999 2024-03-10 23:25:16 +01:00 committed by GitHub
parent d9e8ca2c83
commit f69fddc6e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1143,7 +1143,7 @@ bool wxTitleManagerList::SortFunc(int column, const Type_t& v1, const Type_t& v2
// check column: title id -> type -> path
if (column == ColumnTitleId)
{
// ensure strong ordering -> use type since only one entry should be now (should be changed if every save for every user is displayed spearately?)
// ensure strong ordering -> use type since only one entry should be now (should be changed if every save for every user is displayed separately?)
if (entry1.title_id == entry2.title_id)
return SortFunc(ColumnType, v1, v2);
@ -1159,7 +1159,7 @@ bool wxTitleManagerList::SortFunc(int column, const Type_t& v1, const Type_t& v2
}
else if (column == ColumnType)
{
if(std::underlying_type_t<EntryType>(entry1.type) == std::underlying_type_t<EntryType>(entry2.type))
if(entry1.type == entry2.type)
return SortFunc(-1, v1, v2);
return std::underlying_type_t<EntryType>(entry1.type) < std::underlying_type_t<EntryType>(entry2.type);
@ -1178,6 +1178,13 @@ bool wxTitleManagerList::SortFunc(int column, const Type_t& v1, const Type_t& v2
return std::underlying_type_t<EntryType>(entry1.region) < std::underlying_type_t<EntryType>(entry2.region);
}
else if (column == ColumnFormat)
{
if(entry1.format == entry2.format)
return SortFunc(ColumnType, v1, v2);
return std::underlying_type_t<EntryType>(entry1.format) < std::underlying_type_t<EntryType>(entry2.format);
}
return false;
}