Fix null reference exception in ForEach-Object -Parallel input processing#10577
Fix null reference exception in ForEach-Object -Parallel input processing#10577daxian-dbw merged 1 commit intoPowerShell:masterfrom PaulHigin:fix-foreach-parallel-bug1
Conversation
| // Validate piped InputObject | ||
| if (_inputObject.BaseObject is ScriptBlock) | ||
| if (_inputObject != null && | ||
| _inputObject.BaseObject is ScriptBlock) |
There was a problem hiding this comment.
The error message for null does not look correct.
There was a problem hiding this comment.
A null input object is valid, so there is no error for that. This check just prevents a null dereference when checking the input type.
|
Hello @daxian-dbw! Because this pull request has the Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 24 hours, a condition that will be fulfilled in about 30 minutes. No worries though, I will be back when the time is right! 😉 p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
🎉 Handy links: |
PR Summary
Fixes a null reference exception in the ForEach-Object -Parallel experimental feature.
PR Context
Piped input can be null, but a type check in parallel processing was not accounting for it. The result was a null reference exception.
Fix is to add a null check.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.