Skip to content

fix(core): add null guards for vehicle pointers in render setup - #305

Merged
user-grinch merged 1 commit into
user-grinch:mainfrom
CanerKaraca23:fix/core-reset-vehicle-render-pointer
Sep 9, 2026
Merged

fix(core): add null guards for vehicle pointers in render setup#305
user-grinch merged 1 commit into
user-grinch:mainfrom
CanerKaraca23:fix/core-reset-vehicle-render-pointer

Conversation

@CanerKaraca23

@CanerKaraca23 CanerKaraca23 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

  1. When ModelInfoMgr::SetupRender(CVehicle *ptr) was called with a null pointer (e.g. during certain world rendering passes or detached object/component setups), dereferencing ptr->SetupRender() caused an immediate access violation crash:
    Unhandled exception at 0x06B41E06 in modelextras.asi (+0x71e06): 0xC0000005: Access violation reading location 0x00000024.
    
  2. In LicensePlate::CCustomCarPlateMgr_SetupMaterialPlatebackTexture, calling m_VehData.Get(pCurrentVeh) when pCurrentVeh was not yet initialized or null resulted in null pointer dereference crashes.

Solution

  1. Added early null guard in ModelInfoMgr::SetupRender: if (!ptr) { return; }.
  2. Added null guard in LicensePlate::CCustomCarPlateMgr_SetupMaterialPlatebackTexture: if (!pCurrentVeh) { return material; }.

@CanerKaraca23
CanerKaraca23 force-pushed the fix/core-reset-vehicle-render-pointer branch from 554fd79 to a53dda3 Compare September 8, 2026 20:31
@CanerKaraca23 CanerKaraca23 changed the title fix(core): reset current vehicle pointer on render finish to prevent use-after-free crash fix(core): add null guards for vehicle pointers in render setup Sep 8, 2026
@user-grinch
user-grinch merged commit 774bfcc into user-grinch:main Sep 9, 2026
1 check passed
@CanerKaraca23
CanerKaraca23 deleted the fix/core-reset-vehicle-render-pointer branch September 9, 2026 08:53
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.

2 participants