Skip to content

fix: don't access a missing arRenderer when syncing camera-target - #5195

Merged
diegoteran merged 1 commit into
google:masterfrom
kwy404:fix-camera-target-without-ar
Sep 29, 2026
Merged

diegoteran merged 1 commit into
google:masterfrom
kwy404:fix-camera-target-without-ar

Conversation

@kwy404

@kwy404 kwy404 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Reference Issue

Fixes #5140

When the renderer can't get a WebGL context, arRenderer is null, and [$syncCameraTarget] reads arRenderer.isPresenting directly, which throws on any camera-target update. This uses Renderer.isPresenting (which already handles the null case, as getCameraTarget does) and optional chaining for updateTarget(), and adds a test that sets camera-target with arRenderer unset.

When WebGL is unavailable the renderer's arRenderer is null, so setting
camera-target threw in $syncCameraTarget.

Fixes google#5140

@diegoteran diegoteran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thank you!

@diegoteran
diegoteran merged commit f8fe190 into google:master Sep 29, 2026
8 checks passed
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.

"arRenderer" can be undefined in Controls.ts

2 participants