git » sdk » commit 16ce799

If there was no last message, use the one from MAM

author Stephen Paul Weber
2024-06-27 02:21:28 UTC
committer Stephen Paul Weber
2024-06-27 02:21:28 UTC
parent 032aaf02d6347dfbfc6d11e5fce5369e0ea9ec55

If there was no last message, use the one from MAM

snikket/Chat.hx +1 -1

diff --git a/snikket/Chat.hx b/snikket/Chat.hx
index 3598bd6..9f349f1 100644
--- a/snikket/Chat.hx
+++ b/snikket/Chat.hx
@@ -733,7 +733,7 @@ class Channel extends Chat {
 			} else {
 				inSync = true;
 				final lastFromSync = chatMessages[chatMessages.length - 1];
-				if (lastFromSync != null && Reflect.compare(lastFromSync.timestamp, lastMessageTimestamp()) > 0) {
+				if (lastFromSync != null && (lastMessageTimestamp() == null || Reflect.compare(lastFromSync.timestamp, lastMessageTimestamp()) > 0)) {
 					setLastMessage(lastFromSync);
 					client.trigger("chats/update", [this]);
 				}