@@ -3179,17 +3179,27 @@ void MainWindow::onCheckForUpdatesActionTriggered()
31793179
31803180void MainWindow::openMemoryCardEditor (const QString& card_a_path, const QString& card_b_path)
31813181{
3182+ bool any_cards_exist = false ;
3183+
31823184 for (const QString& card_path : {card_a_path, card_b_path})
31833185 {
3184- if (!card_path.isEmpty () && ! QFile::exists (card_path) )
3186+ if (!card_path.isEmpty ())
31853187 {
3186- if (QtUtils::MessageBoxQuestion (
3187- this , tr (" Memory Card Not Found" ),
3188- tr (" Memory card '%1' does not exist. Do you want to create an empty memory card?" ).arg (card_path),
3189- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
3188+ if (QFile::exists (card_path))
3189+ {
3190+ any_cards_exist = true ;
3191+ }
3192+ else if (QtUtils::MessageBoxQuestion (
3193+ this , tr (" Memory Card Not Found" ),
3194+ tr (" Memory card '%1' does not exist. Do you want to create an empty memory card?" ).arg (card_path),
3195+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
31903196 {
31913197 Error error;
3192- if (!MemoryCardEditorWindow::createMemoryCard (card_path, &error))
3198+ if (MemoryCardEditorWindow::createMemoryCard (card_path, &error))
3199+ {
3200+ any_cards_exist = true ;
3201+ }
3202+ else
31933203 {
31943204 QtUtils::MessageBoxCritical (this , tr (" Memory Card Not Found" ),
31953205 tr (" Failed to create memory card '%1': %2" )
@@ -3200,6 +3210,10 @@ void MainWindow::openMemoryCardEditor(const QString& card_a_path, const QString&
32003210 }
32013211 }
32023212
3213+ // don't open the editor if no cards exist and we requested one
3214+ if (!any_cards_exist && (!card_a_path.isEmpty () || !card_b_path.isEmpty ()))
3215+ return ;
3216+
32033217 if (!m_memory_card_editor_window)
32043218 m_memory_card_editor_window = new MemoryCardEditorWindow ();
32053219
0 commit comments