Skip to content

Fix crash if command sent to pwsh is just whitespace#10977

Merged
anmenaga merged 2 commits intoPowerShell:masterfrom
SteveL-MSFT:pwsh-whitespace-arg
Nov 4, 2019
Merged

Fix crash if command sent to pwsh is just whitespace#10977
anmenaga merged 2 commits intoPowerShell:masterfrom
SteveL-MSFT:pwsh-whitespace-arg

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT commented Nov 2, 2019

PR Summary

In the early parsing code, a null switchkey can be returned. This isn't expected in later code resulting in an unhandled exception. Fix is to check if switchkey is null before additoinal processing. In this case, just whitespace is sent to PowerShell whereas an empty string returns an error.

PR Context

Fix #10975

PR Checklist

Copy link
Copy Markdown
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM

@anmenaga anmenaga added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 4, 2019
@anmenaga anmenaga added this to the 7.0.0-preview.6 milestone Nov 4, 2019
@anmenaga anmenaga merged commit baf2410 into PowerShell:master Nov 4, 2019
@ghost
Copy link
Copy Markdown

ghost commented Nov 21, 2019

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

@SteveL-MSFT SteveL-MSFT deleted the pwsh-whitespace-arg branch June 6, 2020 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerShell can't handle empty commandline parameter

5 participants