double error and crash fix

This commit is contained in:
Finnley Somdahl 2023-11-05 02:40:40 -06:00
parent 5a482d8307
commit cd3aad1c33
2 changed files with 5 additions and 1 deletions

View file

@ -245,7 +245,7 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
binding.urlSize.visibility = if (video.size != null) View.VISIBLE else View.GONE
binding.urlSize.text =
// if video size is null or 0, show "Unknown Size" else show the size in MB
(if (video.extraNote != null) " : " else "") + (if (video.size == 0) "Unknown Size" else (DecimalFormat("#.##").format(video.size ?: 0).toString()+ " MB"))
(if (video.extraNote != null) " : " else "") + (if (video.size == 0.0) "Unknown Size" else (DecimalFormat("#.##").format(video.size ?: 0).toString()+ " MB"))
}
else {
binding.urlQuality.text = "Multi Quality"

View file

@ -215,6 +215,10 @@ class MangaReaderActivity : AppCompatActivity() {
logError(e)
}
}
//check that index is not out of bounds (crash fix)
if (media.selected!!.sourceIndex >= model.mangaReadSources!!.names.size) {
media.selected!!.sourceIndex = 0
}
binding.mangaReaderSource.text = model.mangaReadSources!!.names[media.selected!!.sourceIndex]
binding.mangaReaderTitle.text = media.userPreferredName