Skip to content

Fix crash when remuxing Opus downloads with missing metadata - #13921

Open
Huge wants to merge 1 commit into
TeamNewPipe:devfrom
Huge:fix/ogg-null-metadata
Open

Huge wants to merge 1 commit into
TeamNewPipe:devfrom
Huge:fix/ogg-null-metadata

Conversation

@Huge

@Huge Huge commented Oct 15, 2026 •

Copy link
Copy Markdown

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • OggFromWebMWriter.makeMetadata() adds the DATE tag only when StreamInfo.getUploadDate() is not null. The upload date is optional (DescriptionFragment checks it too), so remuxing an Opus download of a stream without one crashed with a NullPointerException.
  • makeOpusTagsHeader() skips null values the same way it already skips blank ones, so a missing category or uploader name no longer throws in isBlank().
  • The new OggFromWebMWriterTest covers both cases. Both tests fail on dev with the NPEs from the issue and pass with this change.

Fixes the following issue(s)

Testing/QA

Devices
  • Samsung Galaxy S24 (SM-S921B), Android 16: downloaded the audio of "Me at the zoo" as Opus (160 kbps) with the debug build of this branch. The .opus file plays and has the COMMENT, GENRE, ARTIST, TITLE and DATE tags. A stream without an upload date can't be picked from the UI, so that case is covered by the unit tests below.
Steps for testing
APK for testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

@theimpulson theimpulson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. Just one comment about new code being written in Kotlin and missing copyright and license header.

@ShareASmile ShareASmile added bug Issue is related to a bug downloader Issue is related to the downloader labels Oct 16, 2026
@Huge
Huge force-pushed the fix/ogg-null-metadata branch from 2a47a86 to a0c2409 Compare October 17, 2026 06:10
makeMetadata() dereferenced StreamInfo.getUploadDate() unconditionally,
but the upload date is null when the service does not provide one, so
remuxing such an Opus download to Ogg failed with a NullPointerException.
Text fields like the category or the uploader name can be null as well,
and makeOpusTagsHeader() called isBlank() on them.

Only add the DATE tag when an upload date is known, and skip null values
the same way blank ones are already skipped.

Fixes TeamNewPipe#13870

Reported-by: BS.ehlas.cz
@Huge
Huge force-pushed the fix/ogg-null-metadata branch from a0c2409 to 8667212 Compare October 18, 2026 09:23
@sonarqubecloud

Copy link
Copy Markdown

@Huge

Huge commented Oct 24, 2026

Copy link
Copy Markdown
Author

Friendly ping @theimpulson @AudricV — both requested items (SPDX header attributed to NewPipe contributors, and Kotlin test with package-private makeMetadata() avoiding reflection) have been addressed and CI is all green.

Whenever you get a chance, could you please take another look? Thank you!

@theimpulson
theimpulson requested a review from AudricV October 27, 2026 06:52
@AudricV
AudricV removed their request for review October 27, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug downloader Issue is related to the downloader size/medium PRs with less than 250 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullPointerException in OggFromWebMWriter.makeMetadata() on null stream metadata fields (uploadDate, url, genre)

5 participants