Skip to content

Commit

Permalink
fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobg committed Feb 22, 2022
1 parent 1fc7d67 commit 2c33816
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/android/QRScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,10 @@ public void run() {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
((ViewGroup) mBarcodeView.getParent()).removeView(mBarcodeView);
ViewGroup parent = (ViewGroup) mBarcodeView.getParent();
if (parent != null) {
parent.removeView(mBarcodeView);
}
cameraPreviewing = false;
}
});
Expand Down
1 change: 1 addition & 0 deletions src/common/src/createQRScannerAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ return {
throw new Error('No callback provided to scan method.');
}
var success = function(result) {
// TODO: If there's an error code, then add message.
callback(null, result);
};
cordova.exec(success, errorCallback(callback), 'QRScanner', 'scan', []);
Expand Down

0 comments on commit 2c33816

Please sign in to comment.