Merge pull request #5179 from gavine99/fix-crash-on-share-with-no-displayname

fix crash on share a file with no displayname from other app to talk
This commit is contained in:
Marcel Hibbe 2025-07-23 16:36:28 +02:00 committed by GitHub
commit 30e2406093
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,7 +129,10 @@ object FileUtils {
val cursor: Cursor? = context.contentResolver.query(uri, null, null, null, null)
try {
if (cursor != null && cursor.moveToFirst()) {
filename = cursor.getString(cursor.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME))
val displayNameColumnIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
if (displayNameColumnIndex != -1) {
filename = cursor.getString(displayNameColumnIndex)
}
}
} finally {
cursor?.close()