AttachmentMediaActivity crashes in onStart when the url extra is null
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- mobile-dev
Research direction
Start in AttachmentMediaActivity.kt at the onStart call shown in the stack trace, then trace how the url extra is read and how onCreate handles a missing value. Reproduce the case with the provided adb shell am start command. Done means starting the activity without a url extra no longer crashes and still shows the playback error.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Kotlin
- Stars
- 1.7k
- Forks
- 319
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 73
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from GetStream/stream-chat-android
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
GetStream/stream-chat-android#6616 · 3 comments · 1 reaction ·
Maintainers usually reply within 2 days
-
feature request
Difficulty 3/5 1-2 days Newbie friendliness 65/100
GetStream/stream-chat-android#6556 · 1 comment · 1 reaction ·
Maintainers usually reply within 2 days
-
feature request
Difficulty 4/5 3-5 days Newbie friendliness 55/100
GetStream/stream-chat-android#6359 ·
Maintainers usually reply within 2 days
-
feature request
Difficulty 3/5 1-2 days Newbie friendliness 38/100
GetStream/stream-chat-android#6243 ·
Maintainers usually reply within 2 days
-
compose feature request
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GetStream/stream-chat-android#5612 · 3 comments ·
Maintainers usually reply within 2 days
All issues in GetStream/stream-chat-android
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
mobile-dev-inc/Maestro#3646 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SimonHalvdansson/Harmonic-HN#363 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day