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

Prevent NullReferenceException for null analysis type. #1949

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

hubuk
Copy link
Contributor

@hubuk hubuk commented Nov 7, 2023

PR Summary

Many analysis objects here have null Type field value. Not sure whether this is expected. Probably the Undetermined Type should be used instead of null. Anyway, similar precaution means are used in:

psClass = classes.FirstOrDefault(item => String.Equals(item.Name, details.Type?.FullName, StringComparison.OrdinalIgnoreCase));

Creating test for this problem may be hard as the exception is not always being thrown.

PR Checklist

Many analysis objects here have null Type field value. This leads to premature exiting the method.
Copy link
Collaborator

@bergmeister bergmeister left a comment

Choose a reason for hiding this comment

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

Most of this code was forked from PowerShell's SMA codebase many years ago and not been touched much since. If you've seen an exception coming from this, such a tweak is OK I think and regression risk is small

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.

3 participants