Skip to content

Commit 40956d2

Browse files
authored
fix: crash in last mount on debug compilation (opentibiabr#3284)
1 parent 399d5e4 commit 40956d2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/creatures/players/player.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6950,7 +6950,12 @@ uint8_t Player::getLastMount() const {
69506950
if (value > 0) {
69516951
return value;
69526952
}
6953-
return static_cast<uint8_t>(kv()->get("last-mount")->get<int>());
6953+
const auto lastMount = kv()->get("last-mount");
6954+
if (!lastMount.has_value()) {
6955+
return 0;
6956+
}
6957+
6958+
return static_cast<uint8_t>(lastMount->get<int>());
69546959
}
69556960

69566961
uint8_t Player::getCurrentMount() const {

0 commit comments

Comments
 (0)