A few more crashes fixed

This commit is contained in:
len 2016-04-08 22:57:31 +02:00
parent 72f029b57f
commit 5fbeeade94
5 changed files with 8 additions and 8 deletions

View File

@ -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.

View File

@ -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)
}

View File

@ -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()

View File

@ -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)
}

View File

@ -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 {