Skip to content

Cannot add an image #5

@ovicko

Description

@ovicko

When I click to select an image, I get the following error.

    --------- beginning of crash
2019-03-21 15:00:49.839 4492-4492/com.ovicko.testeditor E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.ovicko.testeditor, PID: 4492
    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=110, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:36475 flg=0x1 }} to activity {com.ovicko.testeditor/com.ovicko.testeditor.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'xute.markdeditor.models.BaseComponentModel xute.markdeditor.models.ComponentTag.getComponent()' on a null object reference
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5041)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5084)
        at android.app.ActivityThread.-wrap20(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7529)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'xute.markdeditor.models.BaseComponentModel xute.markdeditor.models.ComponentTag.getComponent()' on a null object reference
        at xute.markdeditor.components.ImageComponentItem.setCaption(ImageComponentItem.java:255)
        at xute.markdeditor.components.ImageComponentItem.setImageInformation(ImageComponentItem.java:113)
        at xute.markdeditor.components.ImageComponent.getNewImageComponentItem(ImageComponent.java:15)
        at xute.markdeditor.MarkDEditor.insertImage(MarkDEditor.java:385)
        at com.ovicko.testeditor.MainActivity.addImage(MainActivity.java:73)
        at com.ovicko.testeditor.MainActivity.onActivityResult(MainActivity.java:66)
        at android.app.Activity.dispatchActivityResult(Activity.java:7701)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5037)

The issue seems to start from this function

    public void addImage(String filePath) {
        markDEditor.insertImage(filePath);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions