Skip to content

Commit

Permalink
Fixed NullPointerException
Browse files Browse the repository at this point in the history
Added null check for file to avoid NullPointerException

#61
  • Loading branch information
Dhaval2404 committed Mar 12, 2020
1 parent 5ee8638 commit 4df227f
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ object FileUriUtils {
val extension = getImageExtension(uri)
inputStream = context.contentResolver.openInputStream(uri)
file = FileUtil.getImageFile(context.cacheDir, extension)
if (file == null) return null
outputStream = FileOutputStream(file)
if (inputStream != null) {
inputStream.copyTo(outputStream, bufferSize = 4 * 1024)
Expand Down

0 comments on commit 4df227f

Please sign in to comment.