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 null pointer from master on no-pvp combat. #3356

Closed
wants to merge 3 commits into from

Conversation

kaleohanopahala
Copy link
Contributor

  • Now the code checks for a null target right away to prevent crashes.
  • The summon condition is moved up, eliminating redundant checks.
  • Unnecessary null verifications (like if (target && ...)) have been removed.
  • Validations for tile properties and PvP conditions are reorganized for clearer and more efficient logic.

if (player->hasFlag(PlayerFlags_t::IgnoreProtectionZone)) {
return RETURNVALUE_NOERROR;
}
const auto player = caster->getPlayer();
Copy link
Member

@dudantas dudantas Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare as const ref (&), to avoid increment reference counter (same for the others variables)

Suggested change
const auto player = caster->getPlayer();
const auto &player = caster->getPlayer();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ins't?
const auto& player = caster->getPlayer();

Copy link
Contributor Author

@kaleohanopahala kaleohanopahala Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it's time to make lunch. Later, I can come back and check if everything is in order.
I updated it as you mentioned, and I believe it's good.
Thanks for the tip!

#3357

@kaleohanopahala kaleohanopahala closed this by deleting the head repository Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants