Don't crash on empty message
If the message is empty, m.last() causes a NoSuchElementException. Fixes https://github.com/SpiritCroc/SchildiChat-android/issues/17 Change-Id: I31ad5a8e4f8baf5d095cf34f430c5337737442b4
This commit is contained in:
parent
1cc4c7177f
commit
68ed05ae7f
|
@ -54,7 +54,7 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
|
|||
message?.findPillsAndProcess(coroutineScope) { it.bind(holder.messageView) }
|
||||
}
|
||||
var m = message
|
||||
if (m != null) {
|
||||
if (m != null && m.isNotEmpty()) {
|
||||
// Remove last trailing newline: looks especially bad in message bubble
|
||||
if (m.last() == '\n') {
|
||||
m = m.subSequence(0, m.length-1)
|
||||
|
|
Loading…
Reference in New Issue