Describe the bug
AttachmentMediaActivity crashes with a NullPointerException when it's started without a url extra. onCreate catches the null url, logs "This file can't be displayed", and shows the playback error, but binding is already initialized by then. So onStart gets past its ::binding.isInitialized check and calls Uri.parse(url) with null.
java.lang.NullPointerException: uriString
at android.net.Uri$StringUri.<init>(Uri.java:496)
at android.net.Uri$StringUri.<init>(Uri.java:486)
at android.net.Uri.parse(Uri.java:458)
at io.getstream.chat.android.ui.feature.gallery.AttachmentMediaActivity.onStart(AttachmentMediaActivity.kt:95)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1674)
at android.app.Activity.performStart(Activity.java:8018)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3469)
The same code is still in 7.13.0 and on develop.
SDK version
- 7.3.0 (also present in 7.13.0)
To Reproduce
We don't know the exact user steps that end up with a null url, since AttachmentDestination passes assetUrl ?: "". You can hit the crash directly by starting the activity without the extra:
- On an emulator:
adb root, then
adb shell am start -n <your.app.id>/io.getstream.chat.android.ui.feature.gallery.AttachmentMediaActivity --es type video
- See the crash in
onStart
Expected behavior
The activity doesn't crash when the url extra is null.
Device:
- Vendor and model: Honor HRY-LX1T, OnePlus 8 Pro, OnePlus A0001
- Android version: 11
Screenshots
N/A
Describe the bug
AttachmentMediaActivity crashes with a NullPointerException when it's started without a
urlextra.onCreatecatches the null url, logs "This file can't be displayed", and shows the playback error, butbindingis already initialized by then. SoonStartgets past its::binding.isInitializedcheck and callsUri.parse(url)with null.The same code is still in 7.13.0 and on develop.
SDK version
To Reproduce
We don't know the exact user steps that end up with a null url, since
AttachmentDestinationpassesassetUrl ?: "". You can hit the crash directly by starting the activity without the extra:adb root, thenadb shell am start -n <your.app.id>/io.getstream.chat.android.ui.feature.gallery.AttachmentMediaActivity --es type videoonStartExpected behavior
The activity doesn't crash when the url extra is null.
Device:
Screenshots
N/A