From e71850120b174112472fc61170b165caf717ff22 Mon Sep 17 00:00:00 2001 From: Eugen Melnychenko Date: Fri, 25 Oct 2019 13:05:39 +0300 Subject: [PATCH] #151: Attempt to invoke virtual method 'boolean android.hardware.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" --- src/android/Fingerprint.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/android/Fingerprint.java b/src/android/Fingerprint.java index f36c57fb..8319ab39 100644 --- a/src/android/Fingerprint.java +++ b/src/android/Fingerprint.java @@ -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"); @@ -272,7 +272,8 @@ public void run() { } private boolean isFingerprintAuthAvailable() { - return mFingerPrintManager.isHardwareDetected() + return null != mFingerPrintManager + && mFingerPrintManager.isHardwareDetected() && mFingerPrintManager.hasEnrolledFingerprints(); }