[BUG] App crashes when last account is removed from device's settings
Open
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:
- Add one account to the device
- Switch to device settings without closing the app
- Accounts -> oC account ->
Remove Account - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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