diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 77fcc094..7fe4ec54 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -637,7 +637,7 @@ void MainWindow::OnFileMenu(wxCommandEvent& event) wxFileDialog openFileDialog(this, _("Open file to launch"), wxEmptyString, wxEmptyString, wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if (openFileDialog.ShowModal() == wxID_CANCEL) + if (openFileDialog.ShowModal() == wxID_CANCEL || openFileDialog.GetPath().IsEmpty()) return; const wxString wxStrFilePath = openFileDialog.GetPath(); @@ -674,7 +674,7 @@ void MainWindow::OnInstallUpdate(wxCommandEvent& event) { wxDirDialog openDirDialog(nullptr, _("Select folder of title to install"), "", wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST, wxDefaultPosition, wxDefaultSize, _("Select the folder that stores your update, DLC or base game files")); int modalChoice = openDirDialog.ShowModal(); - if (modalChoice == wxID_CANCEL) + if (modalChoice == wxID_CANCEL || openDirDialog.GetPath().IsEmpty()) break; if (modalChoice == wxID_OK) { @@ -715,7 +715,7 @@ void MainWindow::OnNFCMenu(wxCommandEvent& event) wxFileDialog openFileDialog(this, _("Open file to load"), "", "", "All NFC files (bin, dat, nfc)|*.bin;*.dat;*.nfc|All files (*.*)|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST); // TRANSLATE - if (openFileDialog.ShowModal() == wxID_CANCEL) + if (openFileDialog.ShowModal() == wxID_CANCEL || openFileDialog.GetPath().IsEmpty()) return; wxString wxStrFilePath = openFileDialog.GetPath(); uint32 nfcError; diff --git a/src/gui/TitleManager.cpp b/src/gui/TitleManager.cpp index e3675ff2..2440e12c 100644 --- a/src/gui/TitleManager.cpp +++ b/src/gui/TitleManager.cpp @@ -367,7 +367,7 @@ void TitleManager::OnRefreshButton(wxCommandEvent& event) void TitleManager::OnInstallTitle(wxCommandEvent& event) { wxFileDialog openFileDialog(this, _("Select title to install"), "", "", "meta.xml|meta.xml", wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if (openFileDialog.ShowModal() == wxID_CANCEL) + if (openFileDialog.ShowModal() == wxID_CANCEL || openFileDialog.GetPath().IsEmpty()) return; fs::path filePath(openFileDialog.GetPath().wc_str()); @@ -623,13 +623,10 @@ void TitleManager::OnSaveExport(wxCommandEvent& event) const auto persistent_id = (uint32)(uintptr_t)m_save_account_list->GetClientData(selection_index); wxFileDialog path_dialog(this, _("Select a target file to export the save entry"), entry->path.string(), wxEmptyString, "Exported save entry (*.zip)|*.zip", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); - if (path_dialog.ShowModal() != wxID_OK) + if (path_dialog.ShowModal() != wxID_OK || path_dialog.GetPath().IsEmpty()) return; const auto path = path_dialog.GetPath(); - if (path.empty()) - return; - int ze; auto* zip = zip_open(path.ToUTF8().data(), ZIP_CREATE | ZIP_TRUNCATE, &ze); if (!zip) diff --git a/src/gui/components/wxTitleManagerList.cpp b/src/gui/components/wxTitleManagerList.cpp index de563d6c..7ba8d037 100644 --- a/src/gui/components/wxTitleManagerList.cpp +++ b/src/gui/components/wxTitleManagerList.cpp @@ -375,7 +375,7 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId) // ask the user to provide a path for the output file wxFileDialog saveFileDialog(this, _("Save Wii U game archive file"), defaultDir, wxHelper::FromUtf8(defaultFileName), "WUA files (*.wua)|*.wua", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); - if (saveFileDialog.ShowModal() == wxID_CANCEL) + if (saveFileDialog.ShowModal() == wxID_CANCEL || saveFileDialog.GetPath().IsEmpty()) return; fs::path outputPath(wxHelper::MakeFSPath(saveFileDialog.GetPath())); fs::path outputPathTmp(wxHelper::MakeFSPath(saveFileDialog.GetPath().append("__tmp")));