Fix npe crash in visibility check
Summary: https://fb.workplace.com/groups/443457641253219/permalink/1716178925529425/ we had this stack trace which i belive is because we are accessing the litho view after its been unmounted, this is possible as the attributes fetching is async. To fix we move this part to be sync on the main thread ui-debugger] Client error during traversal: {\n \"nodeName\": \"DeferredProcessing\",\n \"errorType\": \"NullPointerException\",\n \"errorMessage\": \"Attempt to invoke virtual method 'com.facebook.rendercore.extensions.ExtensionState com.facebook.litho.LithoHostListenerCoordinator.getVisibilityExtensionState()' on a null object reference\",\n \"stack\": \"java.lang.NullPointerException: Attempt to invoke virtual method 'com.facebook.rendercore.extensions.ExtensionState com.facebook.litho.LithoHostListenerCoordinator.getVisibilityExtensionState()' on a null object reference\\n\\tat com.facebook.litho.LithoView.getVisibilityExtensionState(LithoView.java:710)\\n\\tat com.facebook.litho.DebugComponent$Companion.isVisible(DebugComponent.kt:406)\\n\\tat com.facebook.flipper.plugins.uidebugger.litho.descriptors.DebugComponentDescriptor.getMountingData(DebugComponentDescriptor.kt:182)\\n\\tat com.facebook.flipper.plugins.uidebugger.litho.descriptors.DebugComponentDescriptor.access$getMountingData(DebugComponentDescriptor.kt:32)\\n\\tat com.facebook.flipper.plugins.uidebugger.litho.descriptors.Debug Reviewed By: adityasharat Differential Revision: D50843793 fbshipit-source-id: 8c1df8b291371fd379cb819df33ed933f36026a6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
254110bf02
commit
620b41b691
@@ -7,7 +7,6 @@
|
||||
|
||||
package com.facebook.flipper.plugins.uidebugger.litho.descriptors
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import com.facebook.flipper.plugins.uidebugger.descriptors.DescriptorRegister
|
||||
import com.facebook.flipper.plugins.uidebugger.descriptors.Id
|
||||
import com.facebook.flipper.plugins.uidebugger.descriptors.MetadataRegister
|
||||
@@ -102,10 +101,13 @@ class DebugComponentDescriptor(val register: DescriptorRegister) : NodeDescripto
|
||||
override fun getAttributes(
|
||||
node: DebugComponent
|
||||
): MaybeDeferred<Map<MetadataId, InspectableObject>> {
|
||||
|
||||
// this accesses the litho view so do this on the main thread
|
||||
val mountingData = getMountingData(node)
|
||||
|
||||
return Deferred {
|
||||
val attributeSections = mutableMapOf<MetadataId, InspectableObject>()
|
||||
|
||||
val mountingData = getMountingData(node)
|
||||
attributeSections[MountingDataId] = InspectableObject(mountingData)
|
||||
|
||||
val layoutProps = LayoutPropExtractor.getProps(node)
|
||||
@@ -139,8 +141,6 @@ class DebugComponentDescriptor(val register: DescriptorRegister) : NodeDescripto
|
||||
return tags
|
||||
}
|
||||
|
||||
override fun getSnapshot(node: DebugComponent, bitmap: Bitmap?): Bitmap? = null
|
||||
|
||||
override fun getInlineAttributes(node: DebugComponent): Map<String, String> {
|
||||
val attributes = mutableMapOf<String, String>()
|
||||
val key = node.key
|
||||
|
||||
Reference in New Issue
Block a user