From ef6a36241ea1c2bacb839a9270eefa16278274fc Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 12 Jan 2018 16:58:50 +0100 Subject: [PATCH] Qt: fix CurrentSelectionIconPath() --- rpcs3/rpcs3qt/game_list_frame.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index c91476fda4..f00b24d692 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -1232,18 +1232,13 @@ std::string game_list_frame::CurrentSelectionIconPath() { std::string selection = ""; - // The index can be more than the size of m_game_data if you use the VFS to load a directory which has less games. - if (m_oldLayoutIsList && m_gameList->selectedItems().count() && m_gameList->currentRow() < m_game_data.size()) + if (m_gameList->selectedItems().count()) { - selection = m_game_data.at(m_gameList->item(m_gameList->currentRow(), 0)->data(Qt::UserRole).toInt()).info.icon_path; - } - else if (!m_oldLayoutIsList && m_xgrid->selectedItems().count()) - { - int ind = m_xgrid->currentItem()->data(Qt::UserRole).toInt(); + QTableWidgetItem* item = m_oldLayoutIsList ? m_gameList->item(m_gameList->currentRow(), 0) : m_xgrid->currentItem(); + int ind = item->data(Qt::UserRole).toInt(); + if (ind < m_game_data.size()) - { selection = m_game_data.at(ind).info.icon_path; - } } m_oldLayoutIsList = m_isListLayout;