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

Update spells.cpp | fix very rare crash bug. #2582

Merged
merged 7 commits into from
May 22, 2019

Conversation

marcinho1994
Copy link
Contributor

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.

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.
Copy link
Member

@nekiro nekiro left a 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 }

@EvilHero90
Copy link
Contributor

this would close #2570 just doing this so it gets linked through.

Copy link
Contributor

@vankk vankk left a comment

Choose a reason for hiding this comment

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

LGTM

src/spells.cpp Outdated Show resolved Hide resolved
src/spells.cpp Outdated Show resolved Hide resolved
src/spells.cpp Outdated Show resolved Hide resolved
@ranisalt
Copy link
Member

Maybe we should use more references and less pointers. Checking for nullptr everywhere is very, very weak.

@nekiro
Copy link
Member

nekiro commented May 14, 2019

Maybe we should use more references and less pointers. Checking for nullptr everywhere is very, very weak.

or more smart pointers

Copy link
Contributor Author

@marcinho1994 marcinho1994 left a comment

Choose a reason for hiding this comment

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

Like this?

src/monster.cpp Outdated Show resolved Hide resolved
src/monster.cpp Show resolved Hide resolved
@DSpeichert DSpeichert merged commit 665852f into otland:master May 22, 2019
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.

9 participants