Skip to content

In DefaultLottieFetchResult, catch NPE from getErrorFromConnection() #2643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

hansonchris
Copy link
Contributor

The getErrorFromConnection() method attempts to construct an InputStreamReader, passing in HttpURLConnection.getErrorStream() as the constructor's arg. According to the doc for HttpURLConnection.getErrorStream(), this method can return null if there have been no errors, the connection is not connected or the server sent no useful data. The InputStreamReader(InputStream) constructor passes its arg to java.io.Reader, and that class throws an NPE if the arg is null.

The getErrorFromConnection() method attempts to construct an InputStreamReader, passing in HttpURLConnection.getErrorStream() as the constructor's arg. According to the doc for HttpURLConnection.getErrorStream(), this method can return null if there have been no errors, the connection is not connected or the server sent no useful data. The InputStreamReader(InputStream) constructor passes its arg to java.io.Reader, and that class throws an NPE if the arg is null.
Copy link

Snapshot Tests
API 23: Report Diff
API 31: Report Diff

@gpeal gpeal merged commit 8c06610 into airbnb:master Jun 24, 2025
7 checks passed
@gpeal
Copy link
Collaborator

gpeal commented Jun 24, 2025

Thanks!

@hansonchris
Copy link
Contributor Author

Definitely, thanks @gpeal for the quick merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants