We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
exists
1 parent 73bf385 commit 69aa9d1Copy full SHA for 69aa9d1
1 file changed
dfc/src/main/java/com/lazygeniouz/dfc/resolver/ResolverCompat.kt
@@ -89,8 +89,14 @@ internal object ResolverCompat {
89
* Returns True if the Document Folder / File exists, False otherwise.
90
*/
91
internal fun exists(context: Context, uri: Uri): Boolean {
92
- getCursor(context, uri, idProjection)?.use { cursor -> return (cursor.count > 0) }
93
- return false
+ return try {
+ getCursor(context, uri, idProjection)?.use { cursor ->
94
+ cursor.count > 0
95
+ } ?: false
96
+ } catch (exception: Exception) {
97
+ ErrorLogger.logError("Exception while checking if the uri exists", exception)
98
+ false
99
+ }
100
}
101
102
/**
0 commit comments