Qt: Fix crash on scanning empty directory

This commit is contained in:
Connor McLaughlin
2022-07-22 23:33:59 +10:00
parent 701780e2ef
commit 91fcb56148
6 changed files with 15 additions and 7 deletions

View File

@ -361,7 +361,8 @@ void ControllerMacroEditWidget::modFrequency(s32 delta)
void ControllerMacroEditWidget::updateFrequency()
{
m_bwidget->getDialog()->setIntValue(m_bwidget->getConfigSection().c_str(),
fmt::format("Macro{}Frequency", m_index).c_str(), static_cast<s32>(m_frequency));
fmt::format("Macro{}Frequency", m_index + 1u).c_str(),
static_cast<s32>(m_frequency));
updateFrequencyText();
}

View File

@ -248,7 +248,7 @@ bool ControllerSettingsDialog::getBoolValue(const char* section, const char* key
return Host::GetBaseBoolSettingValue(section, key, default_value);
}
bool ControllerSettingsDialog::getIntValue(const char* section, const char* key, s32 default_value) const
s32 ControllerSettingsDialog::getIntValue(const char* section, const char* key, s32 default_value) const
{
if (m_profile_interface)
return m_profile_interface->GetIntValue(section, key, default_value);

View File

@ -50,7 +50,7 @@ public:
// Helper functions for updating setting values globally or in the profile.
bool getBoolValue(const char* section, const char* key, bool default_value) const;
bool getIntValue(const char* section, const char* key, s32 default_value) const;
s32 getIntValue(const char* section, const char* key, s32 default_value) const;
std::string getStringValue(const char* section, const char* key, const char* default_value) const;
void setBoolValue(const char* section, const char* key, bool value);
void setIntValue(const char* section, const char* key, s32 value);

View File

@ -420,6 +420,7 @@ void MainWindow::destroyDisplayWidget(bool show_game_list)
{
m_game_list_widget->setVisible(true);
setCentralWidget(m_game_list_widget);
m_game_list_widget->resizeTableViewColumnsToFit();
}
}
else
@ -427,7 +428,10 @@ void MainWindow::destroyDisplayWidget(bool show_game_list)
AssertMsg(m_ui.mainContainer->indexOf(m_display_widget) == 1, "Display widget in stack");
m_ui.mainContainer->removeWidget(m_display_widget);
if (show_game_list)
{
m_ui.mainContainer->setCurrentIndex(0);
m_game_list_widget->resizeTableViewColumnsToFit();
}
}
}
@ -1187,6 +1191,7 @@ void MainWindow::onGameListRefreshProgress(const QString& status, int current, i
void MainWindow::onGameListRefreshComplete()
{
m_ui.statusBar->clearMessage();
clearProgressBar();
}
@ -1650,7 +1655,7 @@ void MainWindow::updateWindowState(bool force_visible)
void MainWindow::setProgressBar(int current, int total)
{
const int value = (current * 100) / total;
const int value = (total != 0) ? ((current * 100) / total) : 0;
if (m_status_progress_widget->value() != value)
m_status_progress_widget->setValue(value);