git » sdk » commit 02e852e

If lastMessage is null we can replace it

author Stephen Paul Weber
2026-04-29 03:02:39 UTC
committer Stephen Paul Weber
2026-04-29 03:11:23 UTC
parent c88a3547912a7413ab951940733f4380a361b31a

If lastMessage is null we can replace it

borogove/Chat.hx +2 -2

diff --git a/borogove/Chat.hx b/borogove/Chat.hx
index 8c12a87..3bff4c3 100644
--- a/borogove/Chat.hx
+++ b/borogove/Chat.hx
@@ -1129,7 +1129,7 @@ class DirectChat extends Chat {
 			message.versions = corrected.versions[corrected.versions.length - 1]?.localId == correct.localId ? cast corrected.versions : [message.build()];
 			message.localId = toSendId;
 			sendMessageStanza(message.build().asStanza(), outboxItem);
-			if (corrected.canReplace(lastMessage)) {
+			if (lastMessage == null || corrected.canReplace(lastMessage)) {
 				setLastMessage(corrected);
 				client.trigger("chats/update", [this]);
 			}
@@ -1961,7 +1961,7 @@ trace("XYZZY no MUC avatar locally matching so fetch vcard", chatId, avatarSha1H
 			message.localId = toSendId;
 			sendMessageStanza(message.build().asStanza(), outboxItem);
 			client.notifyMessageHandlers(corrected, CorrectionEvent);
-			if (corrected.canReplace(lastMessage)) {
+			if (lastMessage == null || corrected.canReplace(lastMessage)) {
 				setLastMessage(corrected);
 				client.trigger("chats/update", [this]);
 			}