fix crash when a unit_placed event kills a unit

fixes #5034
This commit is contained in:
gfgtdf 2020-08-07 00:35:41 +02:00 committed by GitHub
parent 8e9d4b1f82
commit 50715621c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -651,6 +651,9 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat
resources::whiteboard->on_gamestate_change();
resources::game_events->pump().fire("unit_placed", current_loc);
if(!new_unit_itor.valid()) {
return place_recruit_result { true, 0, false };
}
if ( fire_event ) {
const std::string event_name = is_recall ? "prerecall" : "prerecruit";