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

Nullable GIF input causes NullPointerException in GifStreamObject.load

Open Beginner friendly
#2,216 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@blihio is already working on this.

Since Oct 16, 2026.

  • #2217 by @blihio — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, java, kotlin
Domain
mobile

Research direction

Start in encoder/src/main/java/com/pedro/encoder/input/gl/render/filters/object/GifFilterRender.kt around setGif, then GifStreamObject.java where load calls inputStreamGif.available() without a null check. Reproduce with the single-line test from the issue in the encoder module's local unit tests. Done when a null stream is rejected with IOException, as the issue suggests, and the regression test passes. The API choice between IOException and a non-null signature may need a maintainer decision.

Written by the indexing model from the issue text.

Description

Describe the bug

GifFilterRender.setGif(inputStream: InputStream?) accepts a nullable stream, but forwards it to GifStreamObject.load, which calls inputStreamGif.available() without checking for null. Consequently, setGif(null) throws NullPointerException.

This is an inconsistency between the public Kotlin parameter type and the Java loading implementation. The reproducer intentionally supplies null; it does not demonstrate a failure when loading a valid GIF.

To reproduce

Run this local unit test in the encoder module against commit 82a9cb4ee4babdc792d2ccee8b893f2b36207d40:

import com.pedro.encoder.input.gl.render.filters.`object`.GifFilterRender
import org.junit.Test

class GifNullInputTest {
  @Test
  fun reproduce() {
    GifFilterRender().setGif(null)
  }
}

The call fails with NullPointerException inside GifStreamObject.load at inputStreamGif.available().

Expected behavior

Handle null consistently with the public API contract. One option is to reject null with IOException, which is already used for GIF loading failures, while preserving the nullable Kotlin signature. Alternatively, the API could explicitly require a non-null stream.

Environment
  • Source version: 2.8.1, commit 82a9cb4ee4babdc792d2ccee8b893f2b36207d40.
  • Class: GifFilterRender / GifStreamObject, module encoder.
  • Reproduced in the project's Android local unit test task using JDK 17, Gradle 9.7.1 and compile SDK 35.
  • Device / Android OS / media server: not involved in this local unit test reproduction.
Additional context

Relevant source: nullable Kotlin entry point, Java dereference.

I have a small fix and a regression test ready. The test expects IOException: it fails with NPE before the fix and passes after it. With only this fix and its test applied, all 26 encoder and 98 common local unit tests pass.

Dominant language
Kotlin
Stars
3k
Forks
946
Avg merge
5d 1h
Merged PRs (30d)
6

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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 pedroSG94/RootEncoder

All issues in pedroSG94/RootEncoder

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.