From f69fddc6e50aabf71d1c78e73d7bcd6545b8ab92 Mon Sep 17 00:00:00 2001 From: goeiecool9999 <7033575+goeiecool9999@users.noreply.github.com> Date: Sun, 10 Mar 2024 23:25:16 +0100 Subject: [PATCH] TitleManager: Fix crash when sorting by format (#1113) --- src/gui/components/wxTitleManagerList.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/components/wxTitleManagerList.cpp b/src/gui/components/wxTitleManagerList.cpp index d6ad8118..c02bffb7 100644 --- a/src/gui/components/wxTitleManagerList.cpp +++ b/src/gui/components/wxTitleManagerList.cpp @@ -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(entry1.type) == std::underlying_type_t(entry2.type)) + if(entry1.type == entry2.type) return SortFunc(-1, v1, v2); return std::underlying_type_t(entry1.type) < std::underlying_type_t(entry2.type); @@ -1178,6 +1178,13 @@ bool wxTitleManagerList::SortFunc(int column, const Type_t& v1, const Type_t& v2 return std::underlying_type_t(entry1.region) < std::underlying_type_t(entry2.region); } + else if (column == ColumnFormat) + { + if(entry1.format == entry2.format) + return SortFunc(ColumnType, v1, v2); + + return std::underlying_type_t(entry1.format) < std::underlying_type_t(entry2.format); + } return false; }