Skip to content

Commit

Permalink
fix: crash in last mount on debug compilation (#3284)
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE authored Jan 26, 2025
1 parent d9b7bed commit d449359
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6950,7 +6950,12 @@ uint8_t Player::getLastMount() const {
if (value > 0) {
return value;
}
return static_cast<uint8_t>(kv()->get("last-mount")->get<int>());
const auto lastMount = kv()->get("last-mount");
if (!lastMount.has_value()) {
return 0;
}

return static_cast<uint8_t>(lastMount->get<int>());
}

uint8_t Player::getCurrentMount() const {
Expand Down

0 comments on commit d449359

Please sign in to comment.