-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update spells.cpp | fix very rare crash bug. #2582
Conversation
Fixing a very rare bug. In very specific situations, when the creature or target is removed, it can cause a crash, because in this part of the code the methods "creature->getPosition() and target->getPosition()" are used without first checking that they exist. This causes a bug in combat.cpp when trying to use a position that does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the coding style to
if (x) { //code }
this would close #2570 just doing this so it gets linked through. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Maybe we should use more references and less pointers. Checking for |
or more smart pointers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this?
Fixing a very rare bug. In very specific situations, when the creature or target is removed, it can cause a crash, because in this part of the code the methods "creature->getPosition() and target->getPosition()" are used without first checking that they exist. This causes a bug in combat.cpp when trying to use a position that does not exist.