Skip to content

fix(client): prevent native crash in RaycastCamera#216

Open
NebelRebell wants to merge 1 commit intoqbcore-framework:mainfrom
NebelRebell:NebelRebell-patch-1
Open

fix(client): prevent native crash in RaycastCamera#216
NebelRebell wants to merge 1 commit intoqbcore-framework:mainfrom
NebelRebell:NebelRebell-patch-1

Conversation

@NebelRebell
Copy link
Copy Markdown

Adds proper entity validation to prevent native crashes caused by invalid entity handles.

  • Validates entityHit against 0 and -1
  • Uses DoesEntityExist before native calls
  • Fixes parameter order in HasEntityClearLosToEntity
  • Adds safe fallback for entityType == 0

Tested and verified on FiveM game build 2944.

This PR fixes native crashes triggered by invalid entity handles returned from GetShapeTestResult, which could lead to:

SCRIPT ERROR: Error executing native 0x8acd366038d14505
SCRIPT ERROR: Error executing native 0xfcdff7b72d23a1ac

The issue was caused by Lua treating 0 as truthy, allowing invalid entity handles to reach native calls.

  • Have you personally loaded this code into an updated qbcore project and checked all it's functionality? Yes
  • Does your code fit the style guidelines? Yes
  • Does your PR fit the contribution guidelines? Yes

Adds proper entity validation to prevent native crashes caused by invalid entity handles.

- Validates entityHit against 0 and -1
- Uses DoesEntityExist before native calls
- Fixes parameter order in HasEntityClearLosToEntity
- Adds safe fallback for entityType == 0

Tested and verified on FiveM game build 2944.
@ThatMadCap
Copy link
Copy Markdown

Are we going to have to start reviewing AI PRs now?

This is a bit of a mess. The comment choices need a lot of work.

I won't comment on the AI code because I'm not going to read it.

Copy link
Copy Markdown
Member

@Qwerty1Verified Qwerty1Verified left a comment

Choose a reason for hiding this comment

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

This doesn't fit the coding style guide, and similar to what MadCap said, I'd rather us not have to review AI code.

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.

3 participants