Exception on Back button after signing in after sharing a file `java.lang.IllegalStateException: Do not call this method before initializing mStorageManager`
- Dominant language
- Kotlin
- Stars
- 5.6k
- Forks
- 2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 92
Description
### ⚠️ Before posting ⚠️
- [X] This is a **bug**, not a question or an enhancement.
- [X] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [X] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### Steps to reproduce
0. Don't be logged into the Nextcloud app.
1. Share a file with the Nextcloud app. I shared my favourite positions from OSMAnd.
2. Log into your Nextcloud account in the app.
3. Click the Back button of your Android phone. Repeat this until the crash appears. If the app closes, you didn’t reproduce the issue.
### Expected behaviour
The sharing of the file is silently aborted. The Nextcloud app closes. The former app comes up again.
### Actual behaviour
The Nextcloud app goes backwards through the sign in pages. At some point it will show the exception.
### Android version
11
### Device brand and model
Fairphone 4
### Stock or custom OS?
Stock
### Nextcloud android app version
3.23.1 (F-Droid)
### Nextcloud server version
24.0.7
### Using a reverse proxy?
I don't know
### Android logs
### Cause of error
```java
Exception in thread "main" java.lang.IllegalStateException: Do not call this method before initializing mStorageManager
at com.owncloud.android.ui.activity.ReceiveExternalFilesActivity.initTargetFolder(ReceiveExternalFilesActivity.java:998)
at com.owncloud.android.ui.activity.ReceiveExternalFilesActivity.onStart(ReceiveExternalFilesActivity.java:258)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1436)
at android.app.Activity.performStart(Activity.java:8024)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3458)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7715)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
```
### App information
* ID: `com.nextcloud.client`
* Version: `30230190`
* Build flavor: `generic`
### Device information
* Brand: `Fairphone`
* Device: `FP4`
* Model: `FP4`
* Id: `RKQ1.210503.001`
* Product: `FP4eea`
### Firmware
* SDK: `30`
* Release: `11`
* Incremental: `FP4I`
### Server error logs
_No response_
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.