Skip to content

Commit 3a0baa8

Browse files
committed
chore(fc): handle pussible null unwrapping
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 9691034 commit 3a0baa8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

services/flipchat/chat/src/main/kotlin/xyz/flipchat/services/internal/db/ConversationDao.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ interface ConversationDao {
130130
fun clearConversations()
131131

132132
@Query("SELECT unreadCount FROM conversations WHERE idBase58 = :conversationId")
133-
suspend fun getUnreadCount(conversationId: String): Int
134-
suspend fun getUnreadCount(conversationId: ID): Int {
133+
suspend fun getUnreadCount(conversationId: String): Int?
134+
suspend fun getUnreadCount(conversationId: ID): Int? {
135135
return getUnreadCount(conversationId.base58)
136136
}
137137

services/flipchat/sdk/src/main/kotlin/xyz/flipchat/chat/RoomController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class RoomController @Inject constructor(
6767
}
6868

6969
suspend fun getUnreadCount(identifier: ID): Int {
70-
return db.conversationDao().getUnreadCount(identifier)
70+
return db.conversationDao().getUnreadCount(identifier) ?: 0
7171
}
7272

7373
suspend fun getChatMembers(identifier: ID) {

0 commit comments

Comments
 (0)