Fix DropActivePlayerWeapon passing uninitialized vecDropMomentum - #1407
Open
Umbre11as wants to merge 2 commits into
Open
Fix DropActivePlayerWeapon passing uninitialized vecDropMomentum#1407Umbre11as wants to merge 2 commits into
Umbre11as wants to merge 2 commits into
Conversation
…ed second argument
roflmuffin
reviewed
Aug 30, 2026
| Guard.IsValidEntity(activeWeapon); | ||
|
|
||
| VirtualFunction.CreateVoid<nint, nint>(Handle, GameData.GetOffset("CCSPlayer_ItemServices_DropActivePlayerWeapon"))(Handle, activeWeapon.Handle); | ||
| var dropMomentum = new Vector(); |
Owner
There was a problem hiding this comment.
I think we should just pin a static vector zero here rather than making a new one on each instantiation
Author
There was a problem hiding this comment.
Pushed. Using Vector.Zero directly now
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.
The vtable call for DropActivePlayerWeapon was missing the second parameter (const Vector& vecDropMomentum), so the native function read uninitialized stack for it — which could result in NaN entity velocity.
Passes an empty Vector to keep the public API stable, as suggested by @hzqst in the issue.
Tested on a live 1.0.373 server: weapon drops normally without abnormal velocity.
Closes #1214