MainFrame: fix crash when cancelling a dialog.

This commit is contained in:
Guillaume Jacquemin 2020-06-24 10:02:30 +02:00
parent f8d8bb95e5
commit 8cac1a8360

View file

@ -142,7 +142,7 @@ void EvtMainFrame::moveMassEvent(wxCommandEvent&) {
"- If the destination already contains a M.A.S.S., the two will be swapped.\n" "- If the destination already contains a M.A.S.S., the two will be swapped.\n"
"- If the destination contains invalid data, it will be cleared first.", "- If the destination contains invalid data, it will be cleared first.",
*(_manager.massName(source_slot))), *(_manager.massName(source_slot))),
"Slot", "Choose a slot", source_slot + 1, 1, 32, this) - 1; "Slot", "Choose a slot", source_slot + 1, 1, 32, this);
if(choice == -1 || choice == source_slot) { if(choice == -1 || choice == source_slot) {
return; return;
@ -153,7 +153,7 @@ void EvtMainFrame::moveMassEvent(wxCommandEvent&) {
errorMessage(error_prefix + "For security reasons, moving a M.A.S.S. is disabled if the game's status is unknown."); errorMessage(error_prefix + "For security reasons, moving a M.A.S.S. is disabled if the game's status is unknown.");
break; break;
case GameState::NotRunning: case GameState::NotRunning:
if(!_manager.moveMass(source_slot, choice)) { if(!_manager.moveMass(source_slot, choice - 1)) {
errorMessage(error_prefix + _manager.lastError()); errorMessage(error_prefix + _manager.lastError());
} }
break; break;