Fix null reference error in text view descriptor
Summary: Thanks java / google Reviewed By: lblasa Differential Revision: D40021844 fbshipit-source-id: 19d7d04bf8c637964ef6bea5b28224d7b5134c3f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
23ab1e9127
commit
8140244f0a
@@ -21,7 +21,6 @@ object TextViewDescriptor : ChainedDescriptor<TextView>() {
|
||||
node: TextView,
|
||||
attributeSections: MutableMap<SectionName, InspectableObject>
|
||||
) {
|
||||
val typeface = node.typeface
|
||||
|
||||
val props =
|
||||
mutableMapOf<String, Inspectable>(
|
||||
@@ -29,17 +28,20 @@ object TextViewDescriptor : ChainedDescriptor<TextView>() {
|
||||
"textSize" to InspectableValue.Number(node.textSize, false),
|
||||
"textColor" to InspectableValue.Color(node.getTextColors().getDefaultColor(), false))
|
||||
|
||||
val typeFace =
|
||||
val typeface = node.typeface
|
||||
if (typeface != null) {
|
||||
val typeFaceProp =
|
||||
mutableMapOf<String, InspectableValue>(
|
||||
"isBold" to InspectableValue.Boolean(typeface.isBold, false),
|
||||
"isItalic" to InspectableValue.Boolean(typeface.isItalic, false),
|
||||
)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
typeFace["weight"] = InspectableValue.Number(typeface.weight, false)
|
||||
typeFaceProp["weight"] = InspectableValue.Number(typeface.weight, false)
|
||||
}
|
||||
|
||||
props["typeface"] = InspectableObject(typeFace)
|
||||
props["typeface"] = InspectableObject(typeFaceProp)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
props["minLines"] = InspectableValue.Number(node.minLines, false)
|
||||
|
||||
Reference in New Issue
Block a user