Fix #19601: Crash hiring staff with auto placement turned off (#19602)

This commit is contained in:
Matthias Moninger 2023-03-09 14:04:19 +02:00 committed by GitHub
parent 68b92ba7d6
commit 2ac5e070c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -552,12 +552,13 @@ private:
nullLoc.SetNull();
PeepPickupAction pickupAction{ PeepPickupType::Pickup, staff->Id, nullLoc, NetworkGetCurrentPlayerId() };
pickupAction.SetCallback([&staff](const GameAction* ga, const GameActions::Result* result) {
pickupAction.SetCallback([staffId = staff->Id](const GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
return;
auto* staff2 = GetEntity<Staff>(staffId);
auto intent = Intent(WindowClass::Peep);
intent.PutExtra(INTENT_EXTRA_PEEP, staff);
intent.PutExtra(INTENT_EXTRA_PEEP, staff2);
auto* wind = ContextOpenIntent(&intent);
if (wind != nullptr)
{