mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
chore: Some more NPE prevention
This commit is contained in:
parent
ac4a6d59e9
commit
ae3dd32076
1 changed files with 2 additions and 2 deletions
|
@ -31,13 +31,13 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
|
||||||
override fun doWork(): Result {
|
override fun doWork(): Result {
|
||||||
val storageManager: StorageManager by injectLazy()
|
val storageManager: StorageManager by injectLazy()
|
||||||
val notifier = BackupNotifier(context.localeContext)
|
val notifier = BackupNotifier(context.localeContext)
|
||||||
val uri = inputData.getString(LOCATION_URI_KEY)?.toUri() ?: storageManager.getAutomaticBackupsDirectory()?.uri!!
|
val uri = inputData.getString(LOCATION_URI_KEY)?.toUri() ?: storageManager.getAutomaticBackupsDirectory()?.uri
|
||||||
val flags = inputData.getInt(BACKUP_FLAGS_KEY, BackupConst.BACKUP_ALL)
|
val flags = inputData.getInt(BACKUP_FLAGS_KEY, BackupConst.BACKUP_ALL)
|
||||||
val isAutoBackup = inputData.getBoolean(IS_AUTO_BACKUP_KEY, true)
|
val isAutoBackup = inputData.getBoolean(IS_AUTO_BACKUP_KEY, true)
|
||||||
|
|
||||||
notifier.showBackupProgress()
|
notifier.showBackupProgress()
|
||||||
return try {
|
return try {
|
||||||
val location = BackupCreator(context).createBackup(uri, flags, isAutoBackup)
|
val location = BackupCreator(context).createBackup(uri!!, flags, isAutoBackup)
|
||||||
if (!isAutoBackup) notifier.showBackupComplete(UniFile.fromUri(context, location.toUri())!!)
|
if (!isAutoBackup) notifier.showBackupComplete(UniFile.fromUri(context, location.toUri())!!)
|
||||||
Result.success()
|
Result.success()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue