[TF2] Fix a crash with the Reflect power-up vs the Reflect power-up #1734
+6
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently in
CTFPlayer::OnTakeDamage_Alive, this safeguard exists to prevent a stack overflow whenever a reflected damage instance occurs against a player who themselves is also holding a Reflect power-up.The game will still crash when two players with Reflect power-ups attack each other, however, due to two issues:
info.GetDamageType()is checked forTF_DMG_CUSTOM_RUNE_REFLECT, wheninfo.GetDamageCustom()should be checked instead.CTFPlayer::OnTakeDamage_Alive, but new reflected damage instances are created before that function call is reached inCTFPlayer::OnTakeDamage, meaning the stack overflows before this safeguard is ever reached.This PR addresses both of the above issues by rectifying the conditional and moving the safeguard to a more appropriate location.