FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Prevent NullReferenceException for null analysis type. by hubuk · Pull Request #1949 · PowerShell/PSScriptAnalyzer · GitHub

Prevent NullReferenceException for null analysis type. - #1949

Merged
James Truher (JamesWTruher) merged 1 commit into
PowerShell:masterfrom
hubuk:nre-patch
Jan 16, 2024
Merged

Prevent NullReferenceException for null analysis type.#1949
James Truher (JamesWTruher) merged 1 commit into
PowerShell:masterfrom
hubuk:nre-patch

Conversation

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL