mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
catch exceptions thrown at getting file date taken
This commit is contained in:
@ -894,16 +894,14 @@ fun Context.getFileDateTaken(path: String): Long {
|
|||||||
val selection = "${Images.Media.DATA} = ?"
|
val selection = "${Images.Media.DATA} = ?"
|
||||||
val selectionArgs = arrayOf(path)
|
val selectionArgs = arrayOf(path)
|
||||||
|
|
||||||
val cursor = contentResolver.query(uri, projection, selection, selectionArgs, null)
|
try {
|
||||||
cursor?.use {
|
val cursor = contentResolver.query(uri, projection, selection, selectionArgs, null)
|
||||||
if (cursor.moveToFirst()) {
|
cursor?.use {
|
||||||
do {
|
if (cursor.moveToFirst()) {
|
||||||
try {
|
return cursor.getLongValue(Images.Media.DATE_TAKEN)
|
||||||
return cursor.getLongValue(Images.Media.DATE_TAKEN)
|
}
|
||||||
} catch (ignored: Exception) {
|
|
||||||
}
|
|
||||||
} while (cursor.moveToNext())
|
|
||||||
}
|
}
|
||||||
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0L
|
return 0L
|
||||||
|
Reference in New Issue
Block a user