fix: only set syncTarget if it's included and not empty

This commit is contained in:
jubb 2021-03-23 10:35:47 +11:00
parent 6f2bad9b59
commit 0fa62d1b2a

View File

@ -29,7 +29,9 @@ class VisibleMessage : Message() {
fun fromProto(proto: SignalServiceProtos.Content): VisibleMessage? { fun fromProto(proto: SignalServiceProtos.Content): VisibleMessage? {
val dataMessage = if (proto.hasDataMessage()) proto.dataMessage else return null val dataMessage = if (proto.hasDataMessage()) proto.dataMessage else return null
val result = VisibleMessage() val result = VisibleMessage()
if (dataMessage.hasSyncTarget()) {
result.syncTarget = dataMessage.syncTarget result.syncTarget = dataMessage.syncTarget
}
result.text = dataMessage.body result.text = dataMessage.body
// Attachments are handled in MessageReceiver // Attachments are handled in MessageReceiver
val quoteProto = if (dataMessage.hasQuote()) dataMessage.quote else null val quoteProto = if (dataMessage.hasQuote()) dataMessage.quote else null