Skip to content

Commit 2c33816

Browse files
committed
fix NPE
1 parent 1fc7d67 commit 2c33816

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/android/QRScanner.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,10 @@ public void run() {
777777
this.cordova.getActivity().runOnUiThread(new Runnable() {
778778
@Override
779779
public void run() {
780-
((ViewGroup) mBarcodeView.getParent()).removeView(mBarcodeView);
780+
ViewGroup parent = (ViewGroup) mBarcodeView.getParent();
781+
if (parent != null) {
782+
parent.removeView(mBarcodeView);
783+
}
781784
cameraPreviewing = false;
782785
}
783786
});

src/common/src/createQRScannerAdapter.js

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ return {
165165
throw new Error('No callback provided to scan method.');
166166
}
167167
var success = function(result) {
168+
// TODO: If there's an error code, then add message.
168169
callback(null, result);
169170
};
170171
cordova.exec(success, errorCallback(callback), 'QRScanner', 'scan', []);

0 commit comments

Comments
 (0)