mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Avoid crashing if invalid download and backup location is set
Fixes #8252
This commit is contained in:
		| @@ -205,7 +205,7 @@ class AboutScreen : Screen { | ||||
|                 BuildConfig.DEBUG -> { | ||||
|                     "Debug ${BuildConfig.COMMIT_SHA}".let { | ||||
|                         if (withBuildDate) { | ||||
|                             "$it (${getFormattedBuildTime()}" | ||||
|                             "$it (${getFormattedBuildTime()})" | ||||
|                         } else { | ||||
|                             it | ||||
|                         } | ||||
|   | ||||
| @@ -380,8 +380,10 @@ class SettingsBackupScreen : SearchableSettings { | ||||
|                 Preference.PreferenceItem.TextPreference( | ||||
|                     title = stringResource(R.string.pref_backup_directory), | ||||
|                     subtitle = remember(backupDir) { | ||||
|                         UniFile.fromUri(context, backupDir.toUri()).filePath!! + "/automatic" | ||||
|                     }, | ||||
|                         (UniFile.fromUri(context, backupDir.toUri())?.filePath)?.let { | ||||
|                             "$it/automatic" | ||||
|                         } | ||||
|                     } ?: stringResource(R.string.invalid_location, backupDir), | ||||
|                     onClick = { | ||||
|                         try { | ||||
|                             pickBackupLocation.launch(null) | ||||
|   | ||||
| @@ -102,8 +102,8 @@ class SettingsDownloadScreen : SearchableSettings { | ||||
|             pref = currentDirPref, | ||||
|             title = stringResource(R.string.pref_download_directory), | ||||
|             subtitle = remember(currentDir) { | ||||
|                 UniFile.fromUri(context, currentDir.toUri()).filePath!! | ||||
|             }, | ||||
|                 UniFile.fromUri(context, currentDir.toUri())?.filePath | ||||
|             } ?: stringResource(R.string.invalid_location, currentDir), | ||||
|             entries = mapOf( | ||||
|                 defaultDirPair, | ||||
|                 customDirEntryKey to stringResource(R.string.custom_dir), | ||||
|   | ||||
| @@ -57,7 +57,7 @@ class DownloadProvider(private val context: Context) { | ||||
|                 .createDirectory(getMangaDirName(mangaTitle)) | ||||
|         } catch (e: Throwable) { | ||||
|             logcat(LogPriority.ERROR, e) { "Invalid download directory" } | ||||
|             throw Exception(context.getString(R.string.invalid_download_dir)) | ||||
|             throw Exception(context.getString(R.string.invalid_location, downloadsDir)) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user