From 70bb789b82b4116f125948cac8cb2f97f4d6ecc2 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Wed, 31 May 2023 11:31:13 +0500 Subject: [PATCH] mobile: fix crash on download all attachement --- apps/mobile/app/common/filesystem/download-attachment.js | 2 +- .../app/components/attachments/download-attachments.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/mobile/app/common/filesystem/download-attachment.js b/apps/mobile/app/common/filesystem/download-attachment.js index 34ca2c5a4..c0ca928b8 100644 --- a/apps/mobile/app/common/filesystem/download-attachment.js +++ b/apps/mobile/app/common/filesystem/download-attachment.js @@ -130,7 +130,7 @@ export async function downloadAttachments( RNFetchBlob.fs.unlink(zipSourceFolder).catch(console.log); return; } - if (result.size) { + if (result?.size) { let sub; try { onProgress?.(0, `Zipping... Please wait`); diff --git a/apps/mobile/app/components/attachments/download-attachments.js b/apps/mobile/app/components/attachments/download-attachments.js index 6514a4e7f..71b9deb8e 100644 --- a/apps/mobile/app/components/attachments/download-attachments.js +++ b/apps/mobile/app/components/attachments/download-attachments.js @@ -55,7 +55,7 @@ const DownloadAttachments = ({ close, attachments, isNote, update }) => { groupId.current ); if (canceled.current) return; - setResult(result); + setResult(result || new Map()); setDownloading(false); update({ disableClosing: false @@ -113,7 +113,7 @@ const DownloadAttachments = ({ close, attachments, isNote, update }) => { {downloading ? "Downloading attachments" - : result.size + : result?.size ? "Downloaded attachments" : "Download attachments"} @@ -126,7 +126,7 @@ const DownloadAttachments = ({ close, attachments, isNote, update }) => { > {progress.statusText} - ) : result.size ? ( + ) : result?.size ? ( { }} /> - {result.size ? ( + {result?.size ? (