Skip to content

Commit

Permalink
Move loading pages directory into try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
nonproto committed Jun 27, 2024
1 parent 1bba673 commit b406941
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ class ReaderViewModel(
isLTR: Boolean,
@ColorInt bg: Int
) {
scope.launch {
viewModelScope.launchNonCancellable {
if (firstPage.status != Page.State.READY) return@launch
if (secondPage.status != Page.State.READY) return@launch
val manga = manga ?: return@launch
Expand All @@ -866,13 +866,13 @@ class ReaderViewModel(
val notifier = SaveImageNotifier(context)
notifier.onClear()

var directory = storageManager.getPagesDirectory()!!

if (preferences.folderPerManga().get()) {
directory = directory.createDirectory(DiskUtil.buildValidFilename(manga.title))!!
}

try {
var directory = storageManager.getPagesDirectory()!!

if (preferences.folderPerManga().get()) {
directory =
directory.createDirectory(DiskUtil.buildValidFilename(manga.title))!!
}
val file = saveImages(firstPage, secondPage, isLTR, bg, directory, manga)
DiskUtil.scanMedia(context, file.uri)
notifier.onComplete(file)
Expand Down

0 comments on commit b406941

Please sign in to comment.