Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Essentials/src/MediaPicker/MediaPicker.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ async Task<List<FileResult>> PickMultipleUsingPhotoPicker(MediaPickerOptions opt
// Android has a limitation that you need to use a different request for single and multiple picks.
// If the selection limit is 1, we can use the single pick method,
// otherwise we need to use the multiple pick method.
if (options.SelectionLimit == 1)
int selectionLimit = options?.SelectionLimit ?? 1;
if (selectionLimit == 1)
{
var singleResult = await PickUsingPhotoPicker(options, photo);
return singleResult is not null ? [singleResult] : [];
Expand All @@ -258,9 +259,9 @@ async Task<List<FileResult>> PickMultipleUsingPhotoPicker(MediaPickerOptions opt

// Only set the limit for 2 and up. For single selection (limit == 1) is handled above,
// and limit == 0 should be treated as unlimited.
if (options.SelectionLimit >= 2)
if (selectionLimit >= 2)
{
pickVisualMediaRequestBuilder.SetMaxItems(options.SelectionLimit);
pickVisualMediaRequestBuilder.SetMaxItems(selectionLimit);
}

var pickVisualMediaRequest = pickVisualMediaRequestBuilder.Build();
Expand Down