From 3220ec075642782527ca87aaa266fd0437cd0a24 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Mon, 22 Aug 2022 09:44:11 -0400 Subject: [PATCH] fix: null referance exception in mirror length --- src/datalayer/persistance.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/datalayer/persistance.js b/src/datalayer/persistance.js index 124c1049..3a458877 100644 --- a/src/datalayer/persistance.js +++ b/src/datalayer/persistance.js @@ -334,11 +334,11 @@ const _addMirror = async (storeId, url) => { const mirrors = await getMirrors(storeId); // Dont add the mirror if it already exists. - if ( - mirrors.find( - (mirror) => mirror.launcher_id === storeId && mirror.urls.includes(url), - ).length === 0 - ) { + const mirror = mirrors.find( + (mirror) => mirror.launcher_id === storeId && mirror.urls.includes(url), + ); + + if (mirror?.length === 0) { return true; }