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))