mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 18:08:24 +01:00
A few more crashes fixed
This commit is contained in:
parent
72f029b57f
commit
5fbeeade94
@ -237,8 +237,10 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
||||
this.query = query
|
||||
|
||||
// Notify the subject the query has changed.
|
||||
if (isResumed) {
|
||||
presenter.searchSubject.onNext(query)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the library is updated. It sets the new data and updates the view.
|
||||
|
@ -68,7 +68,7 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
|
||||
{ view, download -> view.onChapterStatusChange(download) },
|
||||
{ view, error -> Timber.e(error.cause, error.message) })
|
||||
|
||||
manga = SharedData.get(MangaEvent::class.java)!!.manga
|
||||
manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
|
||||
add(Observable.just(manga)
|
||||
.subscribeLatestCache({ view, manga -> view.onNextManga(manga) }))
|
||||
|
||||
@ -79,9 +79,7 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.doOnNext { chapters ->
|
||||
this.chapters = chapters
|
||||
SharedData.get(ChapterCountEvent::class.java)?.let {
|
||||
it.emit(chapters.size)
|
||||
}
|
||||
SharedData.get(ChapterCountEvent::class.java)?.emit(chapters.size)
|
||||
for (chapter in chapters) {
|
||||
setChapterStatus(chapter)
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class MangaInfoPresenter : BasePresenter<MangaInfoFragment>() {
|
||||
{ view, manga -> view.onFetchMangaDone() },
|
||||
{ view, error -> view.onFetchMangaError() })
|
||||
|
||||
manga = SharedData.get(MangaEvent::class.java)!!.manga
|
||||
manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
|
||||
source = sourceManager.get(manga.source)!!
|
||||
refreshManga()
|
||||
|
||||
|
@ -58,7 +58,7 @@ class MyAnimeListPresenter : BasePresenter<MyAnimeListFragment>() {
|
||||
{ view, result -> view.onRefreshDone() },
|
||||
{ view, error -> view.onRefreshError(error) })
|
||||
|
||||
manga = SharedData.get(MangaEvent::class.java)!!.manga
|
||||
manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
|
||||
start(GET_MANGA_SYNC)
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
||||
super.onCreate(savedState)
|
||||
|
||||
if (savedState == null) {
|
||||
val event = SharedData.remove(ReaderEvent::class.java)!!
|
||||
val event = SharedData.remove(ReaderEvent::class.java) ?: return
|
||||
manga = event.manga
|
||||
chapter = event.chapter
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user