tony-xlh / vision-camera-dynamsoft-document-normalizer

A React Native Vision Camera frame processor plugin for Dynamsoft Document Normalizer
MIT License
45 stars 2 forks source link

Crash in your example projcect #3

Closed yormy closed 11 months ago

yormy commented 1 year ago

When compile and your your exmple project on my device it crashes when loading the cropper

` LOG steady LOG back to cropper LOG is focused LOG update pointsData LOG
LOG pointsText changed LOG previousResults LOG {"current": []} WARN Possible Unhandled Promise Rejection (id: 0): Error: Attempt to get length of null array Error: Attempt to get length of null array

`

tony-xlh commented 1 year ago

What device are you using?

AleksandrTermenzhy commented 1 year ago

Not sure if it's the same but I'm seeing a lot of errors for Android when running DDN (Android 13, Pixel 6):

java.lang.NullPointerException: Attempt to get length of null array
    at com.visioncameradynamsoftdocumentnormalizer.VisionCameraDetectionPlugin.callback(VisionCameraDetectionPlugin.java:19)

It doesn't seem to cause any issues with detection per se, but perhaps it would make sense to handle this case with something like :

        DetectedQuadResult[] quadResults = mModule.detectImageProxy(image);

        if (quadResults != null) { // <-- add this check
             for (DetectedQuadResult quad : quadResults) {
                 // ...
             }
        }
xulihang commented 1 year ago

I use try catch for this exception so it does not crash. I've added the null checking: https://github.com/tony-xlh/vision-camera-dynamsoft-document-normalizer/commit/2a6f428e0dc8a1be3c4e5d5610946f0952be6ce5