react-native-document-scanner icon indicating copy to clipboard operation
react-native-document-scanner copied to clipboard

[BUG] please fix crash for android when onActivityResult called from other module but documentScanner = null

Open fukemy opened this issue 2 years ago • 0 comments

Hi, I am using other lib(photo editor), it's using onActivityResult to get the image, but the module onActivityResult triggered + documentScanner = null => app crashed

Please fix like this to avoid crash

private ActivityEventListener activityEventListener = new BaseActivityEventListener() {
        @Override
        public void onActivityResult(
                final Activity activity,
                final int requestCode,
                final int resultCode,
                final Intent intent) {
            // trigger callbacks (success, cancel, error)
            if (requestCode == DOCUMENT_SCAN_REQUEST) {
                if(documentScanner != null){
                    documentScanner.handleDocumentScanIntentResult(
                            new ActivityResult(resultCode, intent)
                    );
                }
            }
        }
    };

fukemy avatar Jan 17 '23 03:01 fukemy