owncloud / owncloud/android

[BUG] App crashes when last account is removed from device's settings

Open
#4,431 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Contributions are welcome Crash Type:bug
Dominant language
Kotlin
Stars
4.2k
Forks
3.1k
Avg merge
1d 12h
Merged PRs (30d)
7

Description

This one comes from https://github.com/owncloud/android/pull/4410#issuecomment-2186212609

Steps:

  1. Add one account to the device
  2. Switch to device settings without closing the app
  3. Accounts -> oC account -> Remove Account
  4. Switch to oC account

Current:

app crashes, this is the stacktrace:

 FATAL EXCEPTION: DefaultDispatcher-worker-15
                 Process: com.owncloud.android.debug, PID: 32604
                 java.lang.NullPointerException: Parameter specified as non-null is null: method com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource$Companion.toModel, parameter <this>
                 	at com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource$Companion.toModel(Unknown Source:2)
                 	at com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource.getSpaceWithSpecialsByIdForAccount(OCLocalSpacesDataSource.kt:106)
                 	at com.owncloud.android.data.spaces.repository.OCSpacesRepository.getSpaceWithSpecialsByIdForAccount(OCSpacesRepository.kt:67)
                 	at com.owncloud.android.domain.spaces.usecases.GetSpaceWithSpecialsByIdForAccountUseCase.run(GetSpaceWithSpecialsByIdForAccountUseCase.kt:33)
                 	at com.owncloud.android.domain.spaces.usecases.GetSpaceWithSpecialsByIdForAccountUseCase.run(GetSpaceWithSpecialsByIdForAccountUseCase.kt:27)
                 	at com.owncloud.android.domain.BaseUseCase.invoke(BaseUseCase.kt:30)
                 	at com.owncloud.android.presentation.files.filelist.MainFileListViewModel$updateSpace$1.invokeSuspend(MainFileListViewModel.kt:350)
                 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                 	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
                 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
                 	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@75ce667, Dispatchers.IO]
12:08:33.981  E  FATAL EXCEPTION: DefaultDispatcher-worker-18
                 Process: com.owncloud.android.debug, PID: 32604
                 java.lang.NullPointerException: Parameter specified as non-null is null: method com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource$Companion.toModel, parameter <this>
                 	at com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource$Companion.toModel(Unknown Source:2)
                 	at com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource.getSpaceWithSpecialsByIdForAccount(OCLocalSpacesDataSource.kt:106)
                 	at com.owncloud.android.data.spaces.repository.OCSpacesRepository.getSpaceWithSpecialsByIdForAccount(OCSpacesRepository.kt:67)
                 	at com.owncloud.android.domain.spaces.usecases.GetSpaceWithSpecialsByIdForAccountUseCase.run(GetSpaceWithSpecialsByIdForAccountUseCase.kt:33)
                 	at com.owncloud.android.domain.spaces.usecases.GetSpaceWithSpecialsByIdForAccountUseCase.run(GetSpaceWithSpecialsByIdForAccountUseCase.kt:27)
                 	at com.owncloud.android.domain.BaseUseCase.invoke(BaseUseCase.kt:30)
                 	at com.owncloud.android.presentation.files.filelist.MainFileListViewModel$updateSpace$1.invokeSuspend(MainFileListViewModel.kt:350)
                 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                 	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
                 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
                 	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@b6bac14, Dispatchers.IO]

Expected:

login view displayed with no crash

Pixel 2, Android 11
997ea67d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the account-removal steps and start with OCLocalSpacesDataSource.kt:106, following the stack through GetSpaceWithSpecialsByIdForAccountUseCase and MainFileListViewModel.kt:350. Verify the app handles removal of the final account by showing the login view without crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
authentication, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.