Skip to content

Commit

Permalink
Work around a low-frequency crash relating to fragment parameters (2).
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Jan 20, 2025
1 parent cd00247 commit 6b49840
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,28 @@ class BookPreviewActivity : AppCompatActivity(R.layout.activity_book_preview) {

this.loadingProgress.max = 100

this.feedEntry =
this.intent.getSerializableExtra(EXTRA_ENTRY) as FeedEntry.FeedEntryOPDS
val intent = this.intent
if (intent == null) {
this.logger.warn("BookPreviewActivity lacks an intent!")
this.finish()
return
}

val extras = intent.extras
if (extras == null) {
this.logger.warn("BookPreviewActivity intent lacks extras!")
this.finish()
return
}

val entry = extras.getSerializable(EXTRA_ENTRY) as FeedEntry.FeedEntryOPDS?
if (entry == null) {
this.logger.warn("BookPreviewActivity intent lacks OPDS entry!")
this.finish()
return
}

this.feedEntry = entry
MDC.put(MDCKeys.BOOK_TITLE, this.feedEntry.feedEntry.title)
MDC.put(MDCKeys.BOOK_ID, this.feedEntry.feedEntry.id)
MDCKeys.put(MDCKeys.BOOK_PUBLISHER, this.feedEntry.feedEntry.publisher)
Expand Down

0 comments on commit 6b49840

Please sign in to comment.