Skip to content

Commit 89dee9e

Browse files
committed
Changed operator plus
1 parent 915ad30 commit 89dee9e

File tree

1 file changed

+7
-1
lines changed
  • omegatypes/src/main/java/com/omega_r/libs/omegatypes

1 file changed

+7
-1
lines changed

omegatypes/src/main/java/com/omega_r/libs/omegatypes/Text.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ open class Text(protected val defaultTextStyle: TextStyle?) : Serializable {
7878
return TextBuilder.BuilderText(this) + string
7979
}
8080

81+
operator fun plus(textStyle: TextStyle?): Text {
82+
return textStyle?.let { from(this, textStyle = textStyle) } ?: this
83+
}
84+
8185
override fun equals(other: Any?): Boolean {
8286
if (this === other) return true
8387
if (javaClass != other?.javaClass) return false
@@ -323,4 +327,6 @@ operator fun Text?.plus(text: Text?): Text? {
323327
}
324328
}
325329

326-
operator fun Text.plus(textStyle: TextStyle) = Text.from(this, textStyle = textStyle)
330+
operator fun Text?.plus(textStyle: TextStyle?): Text? {
331+
return this?.let { this + textStyle }
332+
}

0 commit comments

Comments
 (0)