From 6496473742df398191eb39b244e1969c370b21d6 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Fri, 26 Jul 2019 08:16:02 -0300 Subject: [PATCH] avoid calling CssStyleFormatter.mergeStyleAttributes if parentStyle or childStyle are null --- .../kotlin/org/wordpress/aztec/plugins/CssUnderlinePlugin.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/plugins/CssUnderlinePlugin.kt b/aztec/src/main/kotlin/org/wordpress/aztec/plugins/CssUnderlinePlugin.kt index 0af94cdc8..b5cb6eba7 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/plugins/CssUnderlinePlugin.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/plugins/CssUnderlinePlugin.kt @@ -45,7 +45,9 @@ class CssUnderlinePlugin( if (hiddenSpan.TAG == SPAN_TAG) { val parentStyle = hiddenSpan.attributes.getValue(CssStyleFormatter.STYLE_ATTRIBUTE) val childStyle = calypsoUnderlineSpan.attributes.getValue(CssStyleFormatter.STYLE_ATTRIBUTE) - hiddenSpan.attributes.setValue(CssStyleFormatter.STYLE_ATTRIBUTE, CssStyleFormatter.mergeStyleAttributes(parentStyle, childStyle)) + if (parentStyle != null && childStyle != null) { + hiddenSpan.attributes.setValue(CssStyleFormatter.STYLE_ATTRIBUTE, CssStyleFormatter.mergeStyleAttributes(parentStyle, childStyle)) + } // remove the extra child span spannable.removeSpan(calypsoUnderlineSpan)