add subcondition for adding subparts in raw message entities

This commit is contained in:
InsanusMokrassar committed 2020-01-05 19:50:04 +06:00
1 parent 72127ce133
commit b095f07b9c
1 file changed
+1 -1
@@ -39,7 +39,7 @@ internal fun RawMessageEntity.asTextParts(source: String, subParts: List<TextPar
else -> RegularTextSource(sourceSubstring)
}.let {
val part = TextPart(range, it)
if (it !is MultilevelTextSource) {
if (it !is MultilevelTextSource && subParts.isNotEmpty()) {
(subParts + part).sortedBy { currentPart -> currentPart.range.first }
} else {
listOf(part)