Skip to content

Commit

Permalink
* Fix last mount crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jprzimba committed Jan 27, 2025
1 parent 3b4b0a3 commit 5f1be6b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7245,7 +7245,13 @@ 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 5f1be6b

Please sign in to comment.