react-native-touch-id icon indicating copy to clipboard operation
react-native-touch-id copied to clipboard

NullPointerException in FingerprintDialog

Open mcuelenaere opened this issue 6 years ago • 2 comments

We are seeing the below error in our production builds:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'void com.rnfingerprint.FingerprintDialog$DialogResultListener.onAuthenticated()' on a null object reference
       at com.rnfingerprint.FingerprintDialog.onAuthenticated(FingerprintDialog.java:140)
       at com.rnfingerprint.FingerprintHandler.onAuthenticationSucceeded(FingerprintHandler.java:49)
       at android.hardware.fingerprint.FingerprintManager$MyHandler.sendAuthenticatedSucceeded(FingerprintManager.java:855)
       at android.hardware.fingerprint.FingerprintManager$MyHandler.handleMessage(FingerprintManager.java:803)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

This is on react-native-touch-id 4.0.4.

The easy solution is to wrap https://github.com/naoufal/react-native-touch-id/blob/master/android/src/main/java/com/rnfingerprint/FingerprintDialog.java#L140 in an if (this. dialogCallback != null) statement, but I'd rather fix the root cause.

I don't see how FingerprintDialog.setDialogCallback() can be called with a null value though, so I don't see how this behaviour could be triggered, based on how the code works.

Any ideas and/or suggestions for solutions? Or should we just fork the repo and wrap the code in if != null checks?

mcuelenaere avatar Aug 28 '18 15:08 mcuelenaere

I have the same issue but with onCanceled on line 184 it happened with android 9.0 Pixel XL Device. Any news about the issue so far?

MorcosS avatar Jan 29 '19 12:01 MorcosS

So, is this still a problem 4 years later? I'm seeing this issue as well.

phil4lif avatar Apr 03 '23 16:04 phil4lif