Skip to content

Commit

Permalink
Fix crash when album with null title exists (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
panpanini authored Sep 9, 2020
1 parent 1534eb5 commit 51c62f2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class MediaGalleryAlbumCursorWrapper(
init {
for (i in 0 until origCount) {
super.moveToPosition(i)
val name = getString(getColumnIndexOrThrow(MediaStore.MediaColumns.BUCKET_DISPLAY_NAME))
val name: String = getString(getColumnIndexOrThrow(MediaStore.MediaColumns.BUCKET_DISPLAY_NAME))
?: continue
if (!addedNames.contains(name)) {
addedNamesCount[name] = 1
filterMap[fCount++] = i
Expand Down Expand Up @@ -118,7 +119,7 @@ class MediaGalleryAlbumCursorWrapper(
return result.toTypedArray()
}

override fun getString(columnIndex: Int): String {
override fun getString(columnIndex: Int): String? {
if (columnIndex == origColumnCount) {
val name = getString(getColumnIndexOrThrow(MediaStore.MediaColumns.BUCKET_DISPLAY_NAME))
return addedNamesCount[name].toString()
Expand Down

0 comments on commit 51c62f2

Please sign in to comment.