diff --git a/native/avatars/avatar-hooks.js b/native/avatars/avatar-hooks.js --- a/native/avatars/avatar-hooks.js +++ b/native/avatars/avatar-hooks.js @@ -133,12 +133,12 @@ function useUploadSelectedMedia( setProcessingOrUploadInProgress: SetState, -): (selection: ?NativeMediaSelection) => Promise { +): (selection: NativeMediaSelection) => Promise { const processSelectedMedia = useProcessSelectedMedia(); const uploadProcessedMedia = useUploadProcessedMedia(); return React.useCallback( - async (selection: ?NativeMediaSelection) => { + async (selection: NativeMediaSelection) => { if (!selection) { Alert.alert( 'Media selection failed', @@ -222,6 +222,9 @@ const selectFromGalleryAndUpdateUserAvatar = React.useCallback(async () => { const selection: ?MediaLibrarySelection = await selectFromGallery(); + if (!selection) { + return; + } const uploadedMediaID = await uploadSelectedMedia(selection); @@ -284,6 +287,9 @@ const selectFromGalleryAndUpdateThreadAvatar = React.useCallback(async () => { const selection: ?MediaLibrarySelection = await selectFromGallery(); + if (!selection) { + return; + } const uploadedMediaID = await uploadSelectedMedia(selection);