Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fixed a NullReferenceException if printing null text #2311

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

NicusorN5
Copy link
Contributor

@NicusorN5 NicusorN5 commented Jun 6, 2024

Fixes this exception if using DebugText.Print(null, ...) by adding a plain null check inside the Print function.

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Stride.Graphics
  StackTrace:
   at Stride.Graphics.FastTextRenderer.DrawString(GraphicsContext graphicsContext, String text, Int32 x, Int32 y)

Related Issue

None, this is just a trivial bug fix. I didn't decide to create a issue for this.

Types of changes

  • N/A Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • N/A New feature (non-breaking change which adds functionality)
  • N/A Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • N/A My change requires a change to the documentation.
  • N/A I have added tests to cover my changes.
  • N/A All new and existing tests passed.
  • I have built and run the editor to try this change out.
    (by creating a new project, and using this script containing a single DebugText.Print call inside the Update method).

Just added a null check in the Print() method.
Copy link
Member

@Kryptos-FR Kryptos-FR left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@Kryptos-FR Kryptos-FR merged commit 988cb09 into stride3d:master Jun 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants