[Crash] Fix crash issue with dropping items and order of operations (#2939)

Should wait to null out invalid_drop until after it is used in log message.
This commit is contained in:
JJ 2023-02-15 21:55:15 -05:00 committed by GitHub
parent 2ae795fd61
commit 4a64048744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -848,13 +848,14 @@ void Client::DropItem(int16 slot_id, bool recurse)
}
}
}
invalid_drop = nullptr;
std::string message = fmt::format(
"Tried to drop an item on the ground that was no-drop! item_name [{}] item_id ({})",
invalid_drop->GetItem()->Name,
invalid_drop->GetItem()->ID
);
invalid_drop = nullptr;
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = message});
GetInv().DeleteItem(slot_id);
return;