Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check nullptr town (avoid crash if town not exist) #2549

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@
return loginPosition;
}
const Position &getTemplePosition() const {
if (!town) {
return Position();

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-20.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]

Check warning on line 661 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-release

returning reference to temporary [-Wreturn-local-addr]
}

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