From 4f26a47eddb76d9e1acc09c200e660fd600e868d Mon Sep 17 00:00:00 2001
From: nonproto <2092019+nonproto@users.noreply.github.com>
Date: Thu, 14 Mar 2024 12:01:39 -0400
Subject: [PATCH] Fix null pointer when backing up and no backup directory is
selected
---
.../eu/kanade/tachiyomi/ui/setting/SettingsDataController.kt | 4 ++++
constants/src/main/res/values/strings.xml | 1 +
2 files changed, 5 insertions(+)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDataController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDataController.kt
index e39d424dd8..318ccf51b4 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDataController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDataController.kt
@@ -184,6 +184,10 @@ class SettingsDataController : SettingsController() {
fun createBackup(flags: Int) {
backupFlags = flags
+ if (storageManager.getBackupDirectory() == null) {
+ activity?.toast(R.string.no_backup_directory_selected)
+ return
+ }
try {
// Use Android's built-in file creator
val intent =
diff --git a/constants/src/main/res/values/strings.xml b/constants/src/main/res/values/strings.xml
index 1859b77e80..af0267482d 100644
--- a/constants/src/main/res/values/strings.xml
+++ b/constants/src/main/res/values/strings.xml
@@ -837,6 +837,7 @@
Invalid backup file
Invalid backup file type: %1$s\nIt should end with ".proto.gz" or ".json".
File is missing data.
+ No backup directory selected
Backup does not contain any manga.
Backup failed
No library entries to back up