Skip to content
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

Add null checks to getExternalFilesDir calls #31

Merged

Conversation

juanamd
Copy link

@juanamd juanamd commented May 1, 2021

Both getExternalStorageDirectory and getExternalStoragePublicDirectory are deprecated in API 29, so they were changed to Context.getExternalFilesDir on a previous commit.
As mentioned in the documentation, Context.getExternalFilesDir() may return null, so a check before chaining calls is needed.

This PR adds such null checks or wraps the call in a try-catch sentence in case of a Promise related call.

Closes #29

@RonRadtke
Copy link
Owner

Thank you very much for directly creating a pull request!

@RonRadtke RonRadtke merged commit e705a4e into RonRadtke:master May 1, 2021
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.

Attempt to invoke virtual method 'java.lang.String java.io.File.getAbsolutePath()' on a null object reference
2 participants