Skip to content

Commit

Permalink
Fix crash from LifecycleRegistry kotlin conversion
Browse files Browse the repository at this point in the history
Fixes #2527
  • Loading branch information
pyricau committed Jun 1, 2023
1 parent 540545e commit 4f81e76
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,11 @@ enum class AndroidObjectInspectors : ObjectInspector {

private val HeapInstance.lifecycleRegistryState: String
get() {
val state = this["androidx.lifecycle.LifecycleRegistry", "mState"]!!.valueAsInstance!!
// LifecycleRegistry was converted to Kotlin
// https://cs.android.com/androidx/platform/frameworks/support/+/36833f9ab0c50bf449fc795e297a0e124df3356e
val stateField = this["androidx.lifecycle.LifecycleRegistry", "state"]
?: this["androidx.lifecycle.LifecycleRegistry", "mState"]!!
val state = stateField.valueAsInstance!!
return state["java.lang.Enum", "name"]!!.value.readAsJavaString()!!
}
},
Expand Down

0 comments on commit 4f81e76

Please sign in to comment.