add a null check at obtaining files to fix some crashes

This commit is contained in:
tibbi 2016-11-06 15:29:54 +01:00
parent 001bf403d1
commit 657b14fdb4

View file

@ -45,7 +45,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
if (cursor != null && cursor.moveToFirst()) { if (cursor != null && cursor.moveToFirst()) {
val pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA) val pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA)
do { do {
val fullPath = cursor.getString(pathIndex) val fullPath: String = cursor.getString(pathIndex) ?: continue
val file = File(fullPath) val file = File(fullPath)
val parentDir = file.parent val parentDir = file.parent