Skip to content

Fix: Add null checks for Overlay.Animator in GraphicsSingleton.OnRender#11

Open
prjanitor wants to merge 2 commits intoBOLL7708:masterfrom
prjanitor:prjanitor/00fb23e4fd073b413e076c9cf981a90c0ecab1c8
Open

Fix: Add null checks for Overlay.Animator in GraphicsSingleton.OnRender#11
prjanitor wants to merge 2 commits intoBOLL7708:masterfrom
prjanitor:prjanitor/00fb23e4fd073b413e076c9cf981a90c0ecab1c8

Conversation

@prjanitor
Copy link
Copy Markdown

Problem

In GraphicsSingleton.OnRender, the code iterates through Session.Overlays.Values and directly accesses overlay.Animator without verifying that the Overlay object or its Animator property is non-null. This causes a NullReferenceException at runtime if:

  1. An Overlay is added to the dictionary with a null Animator
  2. The Animator property is null due to initialization failure

Solution

Added null checks at the beginning of both foreach loops in the OnRender method:

if (overlay == null || overlay.Animator == null) continue;

This safely skips any overlay that is null or has a null animator, preventing the exception while maintaining the rendering pipeline's functionality for valid overlays.

Files Changed

  • OpenVROverlayPipe/GraphicsSingleton.cs - Added null checks in two foreach loops within OnRender method

This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

Add null checks for Overlay and Overlay.Animator before dereferencing in both foreach loops within the OnRender method. This prevents NullReferenceException when an overlay is added with a null Animator or if the Animator property is null due to initialization failure.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

⚠️ Pull requests will only be accepted if the CLA has been signed.

It appears that you have not yet signed the CLA with your GitHub username.
In order to contribute to this project, you must read the CLA fully, and then append the following to the bottom of the document to sign it.

- prjanitor

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