react-native-document-scanner
react-native-document-scanner copied to clipboard
[BUG] please fix crash for android when onActivityResult called from other module but documentScanner = null
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)
);
}
}
}
};