Skip to content

fix(specialpower): Prevent null pointer dereference in Thing::setPosition#526

Open
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/client-520-null-location-check
Open

fix(specialpower): Prevent null pointer dereference in Thing::setPosition#526
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/client-520-null-location-check

Conversation

@seer-by-sentry

Copy link
Copy Markdown

This PR addresses issue CLIENT-520, a fatal crash caused by a null pointer dereference in Thing::setPosition.

Root Cause:
SpecialPowerModule::doSpecialPowerUsingWaypoints intentionally calls triggerSpecialPower(nullptr) for special powers that do not create view objects. This nullptr is then forwarded to SpecialPowerModule::createViewObject. The createViewObject function, however, did not have an early null check for the location parameter. Consequently, after creating a viewObject, it would attempt to call viewObject->setPosition(location) with a null location, leading to an EXCEPTION_ACCESS_VIOLATION_READ.

Solution:
Added an if (location == nullptr) return; guard at the very beginning of SpecialPowerModule::createViewObject in both Generals/ and GeneralsMD/ code paths. This ensures that if a special power does not require a view object (and thus passes a null location), the function exits gracefully without attempting to set the position of a non-existent object at a null location.

Fixes CLIENT-520

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.

0 participants