Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in ConversationMapUtilsKt.asModel #4132

Closed
mahibi opened this issue Sep 2, 2024 · 1 comment
Closed

NPE in ConversationMapUtilsKt.asModel #4132

mahibi opened this issue Sep 2, 2024 · 1 comment
Labels
1. to develop Accepted and waiting to be taken care of (should be only set by nextcloud employees) bug Something isn't working
Milestone

Comments

@mahibi
Copy link
Collaborator

mahibi commented Sep 2, 2024

app version 20.0.0RC1

from gplay console. happened to 36 users so far:

Exception java.lang.NullPointerException:
  at com.nextcloud.talk.data.database.mappers.ConversationMapUtilsKt.asModel
  at com.nextcloud.talk.conversationlist.data.network.OfflineFirstConversationsRepository.getConversation (OfflineFirstConversationsRepository.kt:112)
  at com.nextcloud.talk.conversationlist.data.network.OfflineFirstConversationsRepository.access$getConversation (OfflineFirstConversationsRepository.kt:34)
  at com.nextcloud.talk.conversationlist.data.network.OfflineFirstConversationsRepository$getConversation$1.invokeSuspend
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:102)
  at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run (LimitedDispatcher.kt:111)
  at kotlinx.coroutines.scheduling.TaskImpl.run (Tasks.kt:99)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.kt:584)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:811)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:715)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:702)
@mahibi mahibi added bug Something isn't working 1. to develop Accepted and waiting to be taken care of (should be only set by nextcloud employees) labels Sep 2, 2024
@mahibi mahibi added this to the 20.0.0 milestone Sep 2, 2024
@rapterjet2004
Copy link
Contributor

rapterjet2004 commented Sep 5, 2024

    private suspend fun getConversation(accountId: Long, token: String): ConversationModel {
        val entity = dao.getConversationForUser(accountId, token).first()
        return entity.asModel()
    }

The issue is with getConversation where the asModel mapping function was called on a conversation that didn't exist, which should have been fixed in the recently merged #4069 which added null safety and loaded the conversation to storage if not found.

+ private suspend fun getConversation(accountId: Long, token: String): ConversationModel? {
    val entity = dao.getConversationForUser(accountId, token).first()
+   return entity?.asModel()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of (should be only set by nextcloud employees) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants