Skip to content

[Android][FileSystem] downloadAsync NullPointerException #6818

@jsamr

Description

@jsamr

🐛 Bug Report

Motivations

Because I wanted to share a deficiency that might be difficult to reproduce, involving a network error with okhttp3 library, I would rather label this as a "crash report" than a "bug report". But I will do my best to provide you with the maximum amount of information to help you fix it.

Environment

I am using react-native-unimodules latest @0.7.0. The application using it has been deployed since mid-December, and we have had no issues with the FileSystem unimodule up until now.
But the crash report directly incriminates expo-file-system native java module.

Device information

Samsung Galaxy S8 (SM-G9500) with Android 9, battery level 53%.

Report information

The error was thrown in the downloadAsync function.

Diagnostic

Looks like the onError callback expects thrown errors to have getMessage() method returning a string, but in some rare occurrences the message might be null.

Suggestion

Wrap the e.getMessage() with String.valueOf for null safety sake.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions