Skip to content

Commit

Permalink
Merge pull request #2528 from square/py/fix_registry_crash
Browse files Browse the repository at this point in the history
Fix crash from LifecycleRegistry kotlin conversion
  • Loading branch information
pyricau authored Jun 28, 2023
2 parents 540545e + 4f81e76 commit e798d5c
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 e798d5c

Please sign in to comment.