From 5a317e8a1bbfe79ffb3d7428b879f549b32e1290 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Tue, 16 Nov 2021 12:56:14 +0100 Subject: [PATCH] Show notification if the vault specified for auto upload doesn't exists --- .../java/org/cryptomator/presentation/CryptomatorApp.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt b/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt index 487a6497e..37bf82a3d 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/CryptomatorApp.kt @@ -12,7 +12,6 @@ import androidx.multidex.MultiDexApplication import org.cryptomator.data.cloud.crypto.Cryptors import org.cryptomator.data.cloud.crypto.CryptorsModule import org.cryptomator.data.repository.RepositoryModule -import org.cryptomator.domain.Vault import org.cryptomator.presentation.di.HasComponent import org.cryptomator.presentation.di.component.ApplicationComponent import org.cryptomator.presentation.di.component.DaggerApplicationComponent @@ -124,7 +123,11 @@ class CryptomatorApp : MultiDexApplication(), HasComponent fun startAutoUpload() { val sharedPreferencesHandler = SharedPreferencesHandler(applicationContext()) if (checkToStartAutoImageUpload(sharedPreferencesHandler)) { - val vault: Vault? = applicationComponent.vaultRepository().load(sharedPreferencesHandler.photoUploadVault()) + val vault = try { + applicationComponent.vaultRepository().load(sharedPreferencesHandler.photoUploadVault()) + } catch (e: NullPointerException) { + null + } if (vault?.isUnlocked == true) { val cloud = applicationComponent.cloudRepository().decryptedViewOf(vault) applicationContext().startService(AutoUploadService.startAutoUploadIntent(applicationContext(), cloud))