aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-08-06 14:02:31 -0400
committerLioncash <mathew1800@gmail.com>2018-08-06 14:02:34 -0400
commitab6bc68bc173c4e27b8a4908706f52d7bef3511c (patch)
tree32fe215579607263e84bcdb571b8e864d73e6773 /src
parentbca27da66bcaaf2d43a39e762afe34419ef73d7f (diff)
qt: Don't show error dialog when canceling the Load Folder dialog
Previously, when canceling out of the Load Folder dialog, a user would get an error dialog about the selected folder not containing a main file, however, by canceling out of the dialog, no selection was actually made.
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e28679cd10..bb7f93a8c3 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -631,9 +631,15 @@ void GMainWindow::OnMenuLoadFile() {
}
void GMainWindow::OnMenuLoadFolder() {
- QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory"));
+ const QString dir_path =
+ QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory"));
- QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
+ if (dir_path.isNull()) {
+ return;
+ }
+
+ const QDir dir{dir_path};
+ const QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
if (matching_main.size() == 1) {
BootGame(dir.path() + DIR_SEP + matching_main[0]);
} else {