Fix NPE in spoiler renderer.

This commit is contained in:
Cody Henthorne
2023-06-21 10:10:01 -04:00
parent d989d02af9
commit 07bd8b2fa3
2 changed files with 3 additions and 3 deletions

View File

@@ -64,10 +64,10 @@ fun TextView.setRelativeDrawables(
* Get a lifecycle associated with this view. Care must be taken to ensure
* if activity fallback occurs that the context of the view is correct.
*/
fun View.getLifecycle(): Lifecycle {
fun View.getLifecycle(): Lifecycle? {
return try {
findFragment<Fragment>().viewLifecycleOwner.lifecycle
} catch (e: IllegalStateException) {
ViewUtil.getActivityLifecycle(this)!!
ViewUtil.getActivityLifecycle(this)
}
}