Skip to content

Commit

Permalink
Correct a possible lifecycle crash
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Nov 14, 2023
1 parent e28c23f commit e6acea6
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.librarysimplified.viewer.audiobook

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.os.Bundle
Expand Down Expand Up @@ -1122,14 +1121,18 @@ class AudioBookPlayerActivity :
}

private fun showErrorWithRunnable(
context: Context,
context: Activity,
title: String,
failure: Exception,
execute: () -> Unit
) {
this.log.error("error: {}: ", title, failure)

this.uiThread.runOnUIThread {
if (context.isDestroyed || context.isFinishing) {
return@runOnUIThread
}

MaterialAlertDialogBuilder(context)
.setTitle(title)
.setMessage(failure.localizedMessage)
Expand Down

0 comments on commit e6acea6

Please sign in to comment.