Skip to content

Commit

Permalink
fix: check nullptr town (avoid crash if town not exist) (#2549)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Apr 17, 2024
1 parent 8841433 commit 533e9d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ class Player final : public Creature, public Cylinder, public Bankable {
return loginPosition;
}
const Position &getTemplePosition() const {
if (!town) {
static auto emptyPosition = Position();
return emptyPosition;
}

return town->getTemplePosition();
}
std::shared_ptr<Town> getTown() const {
Expand Down

0 comments on commit 533e9d6

Please sign in to comment.