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

Added an exception throw when a ResourceLayout slot is null #459

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DiegoG1019
Copy link

When a ResourceLayout array was bound to a Pipeline and, by accident, one of its members remained null, the CommandList would throw a NullReferenceException that described very little of the problem and therefore was hard to figure out and debug.

This pull request fixes the issue by adding a check through a null-coalescing operator

@@ -8,6 +9,8 @@ internal static class ValidationHelpers
internal static void ValidateResourceSet(GraphicsDevice gd, ref ResourceSetDescription description)
{
#if VALIDATE_USAGE
if (description.Layout is null)
throw new NullReferenceException("There is no associated ResourceLayout in the provided ResourceSetDescription");
Copy link
Collaborator

Choose a reason for hiding this comment

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

NullReferenceException isn't right here, I would just make this a VeldridException. Veldrid doesn't really throw a large variety of different exceptions.

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.

None yet

2 participants