Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException' on folderName.toString() #11

Open
jokot opened this issue Mar 19, 2022 · 3 comments
Open

java.lang.NullPointerException' on folderName.toString() #11

jokot opened this issue Mar 19, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@jokot
Copy link

jokot commented Mar 19, 2022

Describe the bug
NullPointerException -> force close when folderName is null, its happen when image is on the root folder, just like this log

Library version
1.0.0-RC1

Log from library

D/imagesPlu: id : 17264, contentUri: content://media/external/images/media/17264, diplayName: Screenshot_20220315-151458.png, folder: Screenshots
D/imagesPlu: id : 17263, contentUri: content://media/external/images/media/17263, diplayName: Screenshot_20220315-151314.png, folder: Screenshots
D/imagesPlu: id : 17262, contentUri: content://media/external/images/media/17262, diplayName: ktp2.jpg, folder: null

Error log

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.imagepickerapp, PID: 3931
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toString()' on a null object reference
        at com.himanshoe.pluck.util.MediaLoaderKt.fetchPagePicture(MediaLoader.kt:97)
        at com.himanshoe.pluck.data.PluckRepositoryImpl$getPicturePagingSource$1.invoke(PluckRepository.kt:50)
        at com.himanshoe.pluck.data.PluckRepositoryImpl$getPicturePagingSource$1.invoke(PluckRepository.kt:50)
        at com.himanshoe.pluck.data.PluckDataSource.load(PluckDataSource.kt:40)
        at androidx.paging.PageFetcherSnapshot.doInitialLoad(PageFetcherSnapshot.kt:283)
        at androidx.paging.PageFetcherSnapshot.access$doInitialLoad(PageFetcherSnapshot.kt:54)
        at androidx.paging.PageFetcherSnapshot$pageEventFlow$1.invokeSuspend(PageFetcherSnapshot.kt:163)
        at androidx.paging.PageFetcherSnapshot$pageEventFlow$1.invoke(Unknown Source:8)
        at androidx.paging.PageFetcherSnapshot$pageEventFlow$1.invoke(Unknown Source:4)
        at androidx.paging.CancelableChannelFlowKt$cancelableChannelFlow$1.invokeSuspend(CancelableChannelFlow.kt:30)
        at androidx.paging.CancelableChannelFlowKt$cancelableChannelFlow$1.invoke(Unknown Source:8)
        at androidx.paging.CancelableChannelFlowKt$cancelableChannelFlow$1.invoke(Unknown Source:4)
        at androidx.paging.SimpleChannelFlowKt$simpleChannelFlow$1$1$producer$1$1.invokeSuspend(SimpleChannelFlow.kt:57)
        at androidx.paging.SimpleChannelFlowKt$simpleChannelFlow$1$1$producer$1$1.invoke(Unknown Source:8)
        at androidx.paging.SimpleChannelFlowKt$simpleChannelFlow$1$1$producer$1$1.invoke(Unknown Source:4)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
        at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
        at androidx.paging.SimpleChannelFlowKt$simpleChannelFlow$1$1$producer$1.invokeSuspend(SimpleChannelFlow.kt:52)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69)
        at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:375)
        at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith$default(DispatchedContinuation.kt:278)
        at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:39)
        at kotlinx.coroutines.LazyStandaloneCoroutine.onStart(Builders.common.kt:204)
        at kotlinx.coroutines.JobSupport.startInternal(JobSupport.kt:401)
        at kotlinx.coroutines.JobSupport.start(JobSupport.kt:380)
        at androidx.paging.CachedPageEventFlow$sharedForDownstream$1.invokeSuspend(CachedPageEventFlow.kt:66)
        at androidx.paging.CachedPageEventFlow$sharedForDownstream$1.invoke(Unknown Source:8)
        at androidx.paging.CachedPageEventFlow$sharedForDownstream$1.invoke(Unknown Source:4)
        at kotlinx.coroutines.flow.SubscribedFlowCollector.onSubscription(Share.kt:410)
        at kotlinx.coroutines.flow.SharedFlowImpl.collect(SharedFlow.kt:341)
        at kotlinx.coroutines.flow.SubscribedSharedFlow.collect(Share.kt:400)
        at kotlinx.coroutines.flow.FlowKt__LimitKt$takeWhile$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:124)
        at androidx.paging.CachedPageEventFlow$downstreamFlow$1.invokeSuspend(CachedPageEventFlow.kt:247)
        at androidx.paging.CachedPageEventFlow$downstreamFlow$1.invoke(Unknown Source:8)
        at androidx.paging.CachedPageEventFlow$downstreamFlow$1.invoke(Unknown Source:4)
        at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
        at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
        at androidx.paging.PagingDataDiffer$collectFrom$2.invokeSuspend(PagingDataDiffer.kt:467)
        at androidx.paging.PagingDataDiffer$collectFrom$2.invoke(Unknown Source:8)
        at androidx.paging.PagingDataDiffer$collectFrom$2.invoke(Unknown Source:2)
        at androidx.paging.SingleRunner$runInIsolation$2.invokeSuspend(SingleRunner.kt:59)
E/AndroidRuntime:     at androidx.paging.SingleRunner$runInIsolation$2.invoke(Unknown Source:8)
        at androidx.paging.SingleRunner$runInIsolation$2.invoke(Unknown Source:4)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
        at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
        at androidx.paging.SingleRunner.runInIsolation(SingleRunner.kt:49)
        at androidx.paging.SingleRunner.runInIsolation$default(SingleRunner.kt:44)
        at androidx.paging.PagingDataDiffer.collectFrom(PagingDataDiffer.kt:140)
        at androidx.paging.compose.LazyPagingItems$collectPagingData$2.invokeSuspend(LazyPagingItems.kt:192)
        at androidx.paging.compose.LazyPagingItems$collectPagingData$2.invoke(Unknown Source:8)
        at androidx.paging.compose.LazyPagingItems$collectPagingData$2.invoke(Unknown Source:4)
        at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invokeSuspend(Merge.kt:217)
        at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Unknown Source:13)
        at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Unknown Source:4)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:34)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Unknown Source:8)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Unknown Source:4)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
        at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
        at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$invokeSuspend$$inlined$collect$1.emit(Collect.kt:140)
        at kotlinx.coroutines.flow.SharedFlowImpl.collect(SharedFlow.kt:351)
        at kotlinx.coroutines.flow.ReadonlySharedFlow.collect(Unknown Source:2)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invokeSuspend(Merge.kt:101)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invoke(Unknown Source:8)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invoke(Unknown Source:4)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
        at kotlinx.coroutines.flow.internal.FlowCoroutineKt.flowScope(FlowCoroutine.kt:33)
        at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest.flowCollect(Merge.kt:25)
        at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
        at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(Unknown Source:0)
        at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
        at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
        at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7397)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

To Reproduce
Steps to reproduce the behavior:

  1. On your phone, save any picture that you have to root folder of your storage
  2. Implement pluck with permission
Permission(
    permissions = listOf(
        Manifest.permission.CAMERA,
        Manifest.permission.READ_EXTERNAL_STORAGE
    ),
    goToAppSettings = {
        // Go to App Settings
    }
) {
    Pluck(onPhotoSelected = {
        // List of PluckImage when selecting from Gallery/Camera. When checking with Camera
        // It returns only one item in list
    })
}
  1. run the app on debug mode
  2. accept permission
  3. See error

Desktop

  • OS: Windows 11 Home Single Language
  • Version 21H2

Android Studio

  • Android Studio Bumblebee | 2021.1.1 Patch 1
  • Build #AI-211.7628.21.2111.8139111, built on February 2, 2022

Smartphone (please complete the following information):

  • Device: Asus Max Pro M1
  • OS: Android 10
@hi-manshu
Copy link
Owner

Thank you for this, will check this on priority !

@hi-manshu hi-manshu added the bug Something isn't working label Mar 20, 2022
@m1r0n41k
Copy link

m1r0n41k commented Jun 2, 2022

Any updates of this?

@hi-manshu
Copy link
Owner

Hey can you check now with the new release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants