Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Guard against undefined rectangle in BillboardTexture.loadImage#13487

Open
dannydjrs wants to merge 1 commit into
CesiumGS:mainfrom
dannydjrs:fix/billboard-texture-rectangle-guard
Open

Guard against undefined rectangle in BillboardTexture.loadImage#13487
dannydjrs wants to merge 1 commit into
CesiumGS:mainfrom
dannydjrs:fix/billboard-texture-rectangle-guard

Conversation

@dannydjrs
Copy link
Copy Markdown

Description

BillboardTexture.loadImage reads atlas.rectangles[index].width after
awaiting TextureAtlas.addImage. In some interleavings — most reliably
when the atlas resizes during the frame the image was queued — that slot
can still be undefined, and the access escapes as an unhandled rejection:

Uncaught (in promise) TypeError: Cannot read properties of undefined
(reading 'width')
    at BillboardTexture.loadImage

This shows up in apps that add/remove billboards rapidly (we hit it
through ol-cesium's FeatureConverter.csAddBillboard on a timer-driven
re-render loop).

This change guards the rectangle access and, when it's missing, marks the
texture as FAILED — matching the existing pattern in the same method
for !defined(index) || index === -1.

Issue number and link

#13486

Testing plan

Added a regression spec covering the case where TextureAtlas.addImage
resolves with an index whose rectangle is undefined. The spec asserts the
texture transitions to BillboardLoadState.FAILED and loadImage does
not reject.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

AI acknowledgment

  • I used AI to generate content in this PR
  • If yes, I have reviewed the AI-generated content before submitting

If yes, I used the following Tools(s) and/or Service(s):

  • Claude

If yes, I used the following Model(s):

  • Opus 4.7

@github-actions
Copy link
Copy Markdown
Contributor

Thank you for the pull request, @dannydjrs!

✅ We can confirm we have a CLA on file for you.

@dannydjrs dannydjrs force-pushed the fix/billboard-texture-rectangle-guard branch from 606ceee to 7a26e39 Compare May 12, 2026 14:22
@dannydjrs dannydjrs force-pushed the fix/billboard-texture-rectangle-guard branch from 7a26e39 to a2801a7 Compare May 12, 2026 14:51
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.

1 participant