Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

AttachmentMediaActivity crashes in onStart when the url extra is null

Open Beginner friendly
#6,762 0 comments 0 reactions 0 assignees View on GitHub

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
Tech stack
android, kotlin
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:

  1. 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
  2. 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

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.

More from GetStream/stream-chat-android

All issues in GetStream/stream-chat-android

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.