Protect against no valid assets selected
This commit is contained in:
@@ -185,6 +185,12 @@ function classifyImagePickerAsset(asset: ImagePickerAsset):
|
||||
type = 'image'
|
||||
}
|
||||
|
||||
console.log({
|
||||
asset,
|
||||
type,
|
||||
mimeType,
|
||||
})
|
||||
|
||||
/*
|
||||
* If we weren't able to find a valid type, we don't support this asset.
|
||||
*/
|
||||
@@ -301,6 +307,7 @@ async function processImagePickerAssets(
|
||||
})
|
||||
}
|
||||
|
||||
if (supportedAssets.length > 0) {
|
||||
if (selectableAssetType === 'image') {
|
||||
if (supportedAssets.length > selectionCountRemaining) {
|
||||
errors.add(SelectedAssetError.MaxImages)
|
||||
@@ -350,6 +357,7 @@ async function processImagePickerAssets(
|
||||
supportedAssets = supportedAssets.slice(0, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: selectableAssetType!, // set above
|
||||
|
||||
Reference in New Issue
Block a user