Skip to content

[BUG] NULL POINTER EXCEPTION IN FILEDOWNLOADER #959

@siddu017

Description

@siddu017

Describe the bug

NullPointerException risk in downloadYoutubeOrInstagram:
You do Objects.requireNonNull(process).getInputStream(). If process is null because processBuilder.start() failed, it will throw NPE. Better to check if process != null before reading its streams.

Steps To Reproduce

Configure the program to use an invalid or missing path for the yt-dlp executable (Program.YT_DLP).

Run the downloader on a valid YouTube or Instagram link.

The process fails to start (processBuilder.start() throws IOException or returns null).

The method attempts to read from process.getInputStream() without checking for null.

A NullPointerException is thrown at this line:

java
Copy
Edit
try (BufferedReader reader = new BufferedReader(new InputStreamReader(Objects.requireNonNull(process).getInputStream()))) {

Expected Behavior

No response

Operating System / Environment

Windows 🪟

Screenshots

No response

Additional information

No response

Do you want to work on this issue?

Yes

Metadata

Metadata

Assignees

Labels

App 💻Issues/Pull Requests which update Drifty Application Codebug 🐛Issues/Pull Requests reporting/fixing a bug

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions