Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix crash when app lock is enabled

ammarahm-edc2e541eef548
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 5ee92908e..4d490abdb 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -98,13 +98,13 @@ const App = () => {
try {
checkOrientation();
await SettingsService.init();
+ await loadDatabase();
if (
SettingsService.get().appLockMode &&
SettingsService.get().appLockMode !== 'none'
) {
setVerifyUser(true);
}
- await loadDatabase();
} catch (e) {} finally {
databaseHasLoaded = true;
loadMainApp();
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index 1093f9f1e..1a3c1b4d6 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -99,11 +99,11 @@ const AppLoader = ({onLoad}) => {
load();
}
} else {
- db.user.getUser().then(u => {
+ db?.user?.getUser().then(u => {
if (u) {
setUser(u);
}
- });
+ }).catch(() => {});
}
if (verifyUser) {
onUnlockBiometrics();