Dhaval2404 / ImagePicker

📸Image Picker for Android, Pick an image from Gallery or Capture a new image with Camera

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should catch NullPointerException in FileUriUtils.getPathFromRemoteUri()

himphen opened this issue · comments

For some reasons, in FileUriUtils.getPathFromRemoteUri(), FileUtil.getImageFile(context.cacheDir, extension) returned null and null is passed into FileOutputStream(@NonNull File file). In my case, user choose a file from content://com.microsoft.skydrive.content.StorageAccessProvider.

It may be caused NullPointerException and please consider checking file != null. Thank you.

Caused by java.lang.NullPointerException
       at com.github.dhaval2404.imagepicker.util.FileUriUtils.getPathFromRemoteUri(FileUriUtils.java:158)
       at com.github.dhaval2404.imagepicker.util.FileUriUtils.getRealPath(FileUriUtils.java:31)
       at com.github.dhaval2404.imagepicker.provider.GalleryProvider.handleResult(GalleryProvider.java:102)
       at com.github.dhaval2404.imagepicker.provider.GalleryProvider.onActivityResult(GalleryProvider.java:89)
       at com.github.dhaval2404.imagepicker.ImagePickerActivity.onActivityResult(ImagePickerActivity.java:133)