From 5866e2d536b272c076136471971f2b5dbfb7b55a Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Mon, 10 Oct 2022 13:40:20 +0300 Subject: [PATCH] Handle undefined accounts file --- components/AirdropUpload.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/AirdropUpload.tsx b/components/AirdropUpload.tsx index 1c6ae22..06f2a34 100644 --- a/components/AirdropUpload.tsx +++ b/components/AirdropUpload.tsx @@ -12,7 +12,8 @@ interface AirdropUploadProps { export const AirdropUpload = ({ onChange }: AirdropUploadProps) => { const onFileChange = (event: React.ChangeEvent) => { if (!event.target.files) return toast.error('Error opening file') - if (!event.target.files[0].name.endsWith('.csv')) { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (!event.target.files[0]?.name.endsWith('.csv')) { toast.error('Please select a .csv file!') return onChange([]) }