Skip to content

Commit

Permalink
NiklasMerz#151: Attempt to invoke virtual method 'boolean android.har…
Browse files Browse the repository at this point in the history
…dware.fingerprint.FingerprintManager.isHardwareDetected()' on a null object reference

- Added null check at every place where mFingerPrintManager used to prevent "boolean android.hardware.fingerprint.FingerprintManager.isHardwareDetected()' on a null object reference"
  • Loading branch information
emelnychenko committed Oct 25, 2019
1 parent 5735838 commit e718501
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/android/Fingerprint.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void run() {
mCallbackContext.sendPluginResult(mPluginResult);
}
return true;
} else if (action.equals("isAvailable")) {
} else if (action.equals("isAvailable") && null != mFingerPrintManager) {
if(mFingerPrintManager.isHardwareDetected() && mFingerPrintManager.hasEnrolledFingerprints()){
mPluginResult = new PluginResult(PluginResult.Status.OK, "finger");
mCallbackContext.success("finger");
Expand All @@ -272,7 +272,8 @@ public void run() {
}

private boolean isFingerprintAuthAvailable() {
return mFingerPrintManager.isHardwareDetected()
return null != mFingerPrintManager
&& mFingerPrintManager.isHardwareDetected()
&& mFingerPrintManager.hasEnrolledFingerprints();
}

Expand Down

0 comments on commit e718501

Please sign in to comment.