Merge pull request #5595 from mattsc/undo_assert

Fix potential crash when running commands in synced context
This commit is contained in:
mattsc 2021-06-10 11:08:53 -07:00 committed by GitHub
commit 152e18b9d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,6 +32,7 @@
* So far the use of 'subjective info' is stubbed out.
*/
#include "actions/undo.hpp"
#include "ai/actions.hpp"
#include "ai/manager.hpp"
#include "ai/simulated_actions.hpp"
@ -654,6 +655,7 @@ void recall_result::do_execute()
// Do the actual recalling.
// We ignore possible errors (=unit doesn't exist on the recall list)
// because that was the previous behavior.
resources::undo_stack->clear();
synced_context::run_in_synced_context_if_not_already("recall",
replay_helper::get_recall(unit_id_, recall_location_, recall_from_),
false,
@ -802,6 +804,7 @@ void recruit_result::do_execute()
return;
}
resources::undo_stack->clear();
synced_context::run_in_synced_context_if_not_already("recruit", replay_helper::get_recruit(u->id(), recruit_location_, recruit_from_), false, !preferences::skip_ai_moves());
set_gamestate_changed();