Skip to content

KotlinNullPointerException in RxImagePicker::onImagePicked #70

Open
@yaroslav-android

Description

@yaroslav-android

I recommend not using force unwrap in your libs. When you take photos for some reason on some devices it can return Uri null and in your onImagePicked method it crashes on line 242.

241    private fun onImagePicked(uri: Uri?) {
242        publishSubject.onNext(uri!!)
243        publishSubject.onComplete()
244    }

Fatal Exception: java.lang.RuntimeExceptionUnable to resume activity {com.example.application/com.example.application.presentation.settings.image_setup.ProfileImageSetupScreen}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=196709, result=-1, data=null} to activity {com.example.application/com.example.application.presentation.settings.image_setup.ProfileImageSetupScreen}: kotlin.KotlinNullPointerExceptioncom.mlsdev.rximagepicker.RxImagePicker.onImagePicked (RxImagePicker.java:242)com.mlsdev.rximagepicker.RxImagePicker.onActivityResult (RxImagePicker.java:90)androidx.fragment.app.FragmentActivity.onActivityResult (FragmentActivity.java:170)com.example.application.presentation.settings.image_setup.ProfileImageSetupScreen.onActivityResult (ProfileImageSetupScreen.java:91)

occurs on Android 10-11
Samsung, Motorola, LGE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions