From a427d77076b08fc879cafac6e3f08e09cf5a5450 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 16 Mar 2021 22:09:19 -0700 Subject: [PATCH] =?UTF-8?q?fix=20#1964=20=E2=80=93=20error=20when=20select?= =?UTF-8?q?ing=20no=20files=20to=20import=20after=20previously=20selecting?= =?UTF-8?q?=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/menus/CollectionMenu.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/menus/CollectionMenu.js b/app/menus/CollectionMenu.js index 14b5e466..4c3ad675 100644 --- a/app/menus/CollectionMenu.js +++ b/app/menus/CollectionMenu.js @@ -85,6 +85,12 @@ function CollectionMenu({ async (ev: SyntheticEvent<>) => { const files = getDataTransferFiles(ev); + // Because this is the onChange handler it's possible for the change to be + // from previously selecting a file to not selecting a file – aka empty + if (!files.length) { + return; + } + try { const file = files[0]; const document = await documents.import(file, null, collection.id, {