Skip to content

Commit 0cb5b6d

Browse files
Use an empty array instead of null
Fixes PowerShell#1959 The code on the client expects DefaultChoices to never be `null`. If you send `null`, it tries to access the property `length` on what would be an array.
1 parent 2e456d1 commit 0cb5b6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PowerShellEditorServices/Extensions/Api/EditorUIService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public async Task<string> PromptSelectionAsync(string message, IReadOnlyList<Pro
168168
Caption = string.Empty,
169169
Message = message,
170170
Choices = choiceDetails,
171-
DefaultChoices = defaultChoiceIndex > -1 ? new[] { defaultChoiceIndex } : null,
171+
DefaultChoices = defaultChoiceIndex > -1 ? new[] { defaultChoiceIndex } : Array.Empty<int>(),
172172
})
173173
.Returning<ShowChoicePromptResponse>(CancellationToken.None)
174174
.ConfigureAwait(false);

0 commit comments

Comments
 (0)