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,
|
node: TextView,
|
||||||
attributeSections: MutableMap<SectionName, InspectableObject>
|
attributeSections: MutableMap<SectionName, InspectableObject>
|
||||||
) {
|
) {
|
||||||
val typeface = node.typeface
|
|
||||||
|
|
||||||
val props =
|
val props =
|
||||||
mutableMapOf<String, Inspectable>(
|
mutableMapOf<String, Inspectable>(
|
||||||
@@ -29,18 +28,21 @@ object TextViewDescriptor : ChainedDescriptor<TextView>() {
|
|||||||
"textSize" to InspectableValue.Number(node.textSize, false),
|
"textSize" to InspectableValue.Number(node.textSize, false),
|
||||||
"textColor" to InspectableValue.Color(node.getTextColors().getDefaultColor(), false))
|
"textColor" to InspectableValue.Color(node.getTextColors().getDefaultColor(), false))
|
||||||
|
|
||||||
val typeFace =
|
val typeface = node.typeface
|
||||||
mutableMapOf<String, InspectableValue>(
|
if (typeface != null) {
|
||||||
"isBold" to InspectableValue.Boolean(typeface.isBold, false),
|
val typeFaceProp =
|
||||||
"isItalic" to InspectableValue.Boolean(typeface.isItalic, false),
|
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) {
|
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(typeFaceProp)
|
||||||
}
|
}
|
||||||
|
|
||||||
props["typeface"] = InspectableObject(typeFace)
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
props["minLines"] = InspectableValue.Number(node.minLines, false)
|
props["minLines"] = InspectableValue.Number(node.minLines, false)
|
||||||
props["maxLines"] = InspectableValue.Number(node.maxLines, false)
|
props["maxLines"] = InspectableValue.Number(node.maxLines, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user