From 9e33c9f9b37ecfaad56432ae2cabf167db49e8d5 Mon Sep 17 00:00:00 2001 From: rapterjet2004 Date: Mon, 12 Aug 2024 11:56:21 -0500 Subject: [PATCH] WIP annoying null pointer Signed-off-by: rapterjet2004 --- .../talk/chat/data/network/OfflineFirstChatRepository.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt b/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt index fd3a4f4ab99..a97c13a8e2b 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt @@ -449,9 +449,11 @@ class OfflineFirstChatRepository @Inject constructor( // the parent message is always the newest state, no matter how old the system message is. // that's why we can just take the parent, update it in DB and update the UI messageJson.parentMessage?.let { parentMessageJson -> - val parentMessageEntity = parentMessageJson.asEntity(currentUser.id!!) - chatDao.upsertChatMessage(parentMessageEntity) - _updateMessageFlow.emit(parentMessageEntity.asModel()) + parentMessageJson.message?.let { + val parentMessageEntity = parentMessageJson.asEntity(currentUser.id!!) + chatDao.upsertChatMessage(parentMessageEntity) + _updateMessageFlow.emit(parentMessageEntity.asModel()) + } } }