From 3c5dc5276dbe6b993d49f864bf82a18c7ab47b99 Mon Sep 17 00:00:00 2001 From: Savely Savianok <1986developer@gmail.com> Date: Mon, 30 Dec 2024 01:27:04 +0300 Subject: [PATCH] fix: fixed application crash when count is zero --- page/index.js | 4 ++-- setting/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/page/index.js b/page/index.js index ac87bd0..22fd8b0 100644 --- a/page/index.js +++ b/page/index.js @@ -11,8 +11,8 @@ Page( onInit() { this.getTOTPData().then((x) => { console.log(x) - localStorage.setItem('TOTPs', x) - app._options.globalData.TOTPS = x + localStorage.setItem('TOTPs', x ?? []) + app._options.globalData.TOTPS = x ?? [] this.initPage(); }) .catch(() => { diff --git a/setting/index.js b/setting/index.js index 9400ed2..5cebbe9 100644 --- a/setting/index.js +++ b/setting/index.js @@ -5,7 +5,7 @@ let _props = null; AppSettingsPage({ build(props) { _props = props; - const storage = props.settingsStorage.getItem("TOTPs") + const storage = props.settingsStorage.getItem("TOTPs") ?? [] const totpEntrys = GetTOTPList(storage) const createButton = TextInput({ placeholder: "otpauth://",