leavesCZY / Matisse

A Image/Video Selector Implemented with Jetpack Compose(一个用 Jetpack Compose 实现的 Android 图片视频选择框架)
https://github.com/leavesCZY/Matisse/wiki
Apache License 2.0
773 stars 60 forks source link

0.0.13 版本,在真机 google/pixel3(os 12) 上,选择图片列表为空,问题已找到,作者要是看到了更新下吧 #14

Closed aa86799 closed 1 year ago

aa86799 commented 1 year ago

error log: java.lang.NullPointerException: getString(columnIndex) must not be null at github.leavesczy.matisse.internal.logic.MediaProviderKt.getString(MediaProvider.kt:217) at github.leavesczy.matisse.internal.logic.MediaProviderKt.access$getString(MediaProvider.kt:1) at github.leavesczy.matisse.internal.logic.MediaProvider$loadResources$2.invokeSuspend(MediaProvider.kt:95) at github.leavesczy.matisse.internal.logic.MediaProvider$loadResources$2.invoke(Unknown Source:8) at github.leavesczy.matisse.internal.logic.MediaProvider$loadResources$2.invoke(Unknown Source:4) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:169) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at github.leavesczy.matisse.internal.logic.MediaProvider.loadResources(MediaProvider.kt:57) at github.leavesczy.matisse.internal.logic.MediaProvider.access$loadResources(MediaProvider.kt:21) at github.leavesczy.matisse.internal.logic.MediaProvider$loadResources$4.invokeSuspend(MediaProvider.kt:145) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) 错误定位 private fun Cursor.getString(columnName: String): String { val columnIndex = getColumnIndexOrThrow(columnName) return getString(columnIndex) } 改成如下,可以显示选择图片列表 return getString(columnIndex) ?: ""

leavesCZY commented 1 year ago

@aa86799 能否看下具体是在获取哪个字段抛出了异常吗

aa86799 commented 1 year ago

@aa86799 能否看下具体是在获取哪个字段抛出了异常吗

at github.leavesczy.matisse.internal.logic.MediaProvider$loadResources$2.invokeSuspend(MediaProvider.kt:95) val bucketDisplayName = cursor.getString(MediaStore.Images.Media.BUCKET_DISPLAY_NAME) 这里抛的

leavesCZY commented 1 year ago

@aa86799 感谢反馈,后续我修复下

leavesCZY commented 1 year ago

@aa86799 v0.0.14 版本已解决此问题了,现在相册名为 null 或者为空字符串的图片,均会放到默认相册里