Skip to content

fix(w3ddevice): Add null check for tree tile RGB data in W3DTreeBuffer::drawTrees - #552

Open
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/w3d-tree-buffer-null-check
Open

fix(w3ddevice): Add null check for tree tile RGB data in W3DTreeBuffer::drawTrees#552
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/w3d-tree-buffer-null-check

Conversation

@seer-by-sentry

@seer-by-sentry seer-by-sentry Bot commented Aug 8, 2026

Copy link
Copy Markdown

This PR addresses a fatal EXCEPTION_ACCESS_VIOLATION_READ crash occurring in W3DTreeBuffer::drawTrees.

Root Cause:
The W3DTreeTextureClass::update function (inlined into drawTrees) calls pTile->getRGBDataForWidth(). This method can return a null pointer if the tile's RGB data is unavailable. The subsequent code then dereferenced this potentially null pointer within a loop without any null check, leading to a crash.

Fix:

  1. The call to pTile->getRGBDataForWidth(tilePixelExtent) has been hoisted outside the inner j loop, as its return value is constant for a given tile.
  2. A null check (if (!pTileRGB) continue;) has been added immediately after the call to getRGBDataForWidth(). If the returned pointer (pTileRGB) is null, the processing for the current tile is skipped, preventing the dereference of a null pointer.
  3. The calculation for pBGR (the per-row pointer offset) now correctly uses the pTileRGB base pointer within the j loop.

This change ensures that the application gracefully handles cases where tree tile RGB data might be missing or uninitialized, preventing crashes during tree rendering.

Fixes CLIENT-2Z9

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