Closed aa86799 closed 1 year ago
@aa86799 能否看下具体是在获取哪个字段抛出了异常吗
@aa86799 能否看下具体是在获取哪个字段抛出了异常吗
at github.leavesczy.matisse.internal.logic.MediaProvider$loadResources$2.invokeSuspend(MediaProvider.kt:95) val bucketDisplayName = cursor.getString(MediaStore.Images.Media.BUCKET_DISPLAY_NAME) 这里抛的
@aa86799 感谢反馈,后续我修复下
@aa86799 v0.0.14 版本已解决此问题了,现在相册名为 null 或者为空字符串的图片,均会放到默认相册里
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) ?: ""