Fix client crash when firing at streamed-out vehicle wheels#5058
Open
HeresHavi wants to merge 1 commit into
Open
Fix client crash when firing at streamed-out vehicle wheels#5058HeresHavi wants to merge 1 commit into
HeresHavi wants to merge 1 commit into
Conversation
Check that the targeted vehicle still has native game data before reading its wheel position. Fall back to the vehicle element's cached position when it is streamed out or the wheel index is invalid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Added native vehicle and wheel index checks when custom weapons target vehicle wheels.
Streamed-out vehicles now use the vehicle element's cached position instead of trying to access missing wheel data.
Motivation
A streamed-out vehicle can still be a valid Lua element, but it no longer has a native GTA vehicle. Firing a custom weapon at one of its wheels tried to read the wheel position from that missing object and caused an access violation.
For example, a remote turret resource might keep targeting a car wheel as it drives away. If the car streams out before the turret fires again, the next shot could crash the player's client.
Crash Stack
Reproduction
Before the fix,
fireWeaponimmediately crashed the Debug client with the stack shown above.Test plan
Runtime
CClientWeapon::Fire.true, and the client stayed open. Repeated shots and cleanup/recreation also passed.true.Builds and Tests
Debug | Win32: Build passed, 304 client tests passed.Release | Win32: Build passed, 304 client tests passed.Debug | x64: Server build passed.clang-format.Checklist