Page MenuHomePhabricator

D7638.id25867.diff
No OneTemporary

D7638.id25867.diff

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<boolean>,
-): (selection: ?NativeMediaSelection) => Promise<?string> {
+): (selection: NativeMediaSelection) => Promise<?string> {
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);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 9:49 AM (20 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2451237
Default Alt Text
D7638.id25867.diff (1 KB)

Event Timeline