Catch IAE instead of checking lifecycle.

fork-5.53.8
Alex Hart 2021-10-18 09:54:41 -03:00 zatwierdzone przez Greyson Parrelli
rodzic 26e04ce6d2
commit 566e981473
1 zmienionych plików z 16 dodań i 16 usunięć

Wyświetl plik

@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.util.ThemeUtil
import org.thoughtcrime.securesms.util.ViewUtil
import org.thoughtcrime.securesms.util.visible
import java.lang.IllegalArgumentException
private val TAG = Log.tag(BadgeImageView::class.java)
@ -42,11 +43,7 @@ class BadgeImageView @JvmOverloads constructor(
fun setBadge(badge: Badge?) {
visible = badge != null
val lifecycle = ViewUtil.getActivityLifecycle(this)
if (lifecycle?.currentState == Lifecycle.State.DESTROYED) {
return
}
try {
if (badge != null) {
GlideApp
.with(this)
@ -59,5 +56,8 @@ class BadgeImageView @JvmOverloads constructor(
.with(this)
.clear(this)
}
} catch (e: IllegalArgumentException) {
// Do nothing. Activity was destroyed.
}
}
}