aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/massadd.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/gui/massadd.cpp b/gui/massadd.cpp
index 4e43d342cb..9d4cf6a188 100644
--- a/gui/massadd.cpp
+++ b/gui/massadd.cpp
@@ -149,8 +149,10 @@ void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
ConfMan.flushToDisk();
// And scroll to first detected game
- sort(_games.begin(), _games.end(), GameDescLess());
- ConfMan.set("temp_selection", _games.front().gameid());
+ if (!_games.empty()) {
+ sort(_games.begin(), _games.end(), GameDescLess());
+ ConfMan.set("temp_selection", _games.front().gameid());
+ }
close();
} else if (cmd == kCancelCmd) {