Skip to content

Commit fe84eaa

Browse files
committed
Fix null-handling for modulename
1 parent 0cc26d9 commit fe84eaa

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/System.Management.Automation/engine/CommandSearcher.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,8 @@ private CmdletInfo GetNextCmdlet()
10261026
(_commandResolutionOptions.HasFlag(SearchResolutionOptions.FuzzyMatch) &&
10271027
FuzzyMatcher.IsFuzzyMatch(cmdlet.Name, _commandName)))
10281028
{
1029-
if (PSSnapinQualifiedCommandName?.PSSnapInName?.Equals(cmdlet.ModuleName, StringComparison.OrdinalIgnoreCase) == true)
1029+
string moduleName = PSSnapinQualifiedCommandName?.PSSnapInName;
1030+
if (moduleName == null || moduleName.Equals(cmdlet.ModuleName, StringComparison.OrdinalIgnoreCase))
10301031
{
10311032
// If PSSnapin is specified, make sure they match
10321033
matchingCmdletInfo.Add(cmdlet);

0 commit comments

Comments
 (0)