react-native-touch-id
react-native-touch-id copied to clipboard
NullPointerException in FingerprintDialog
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?
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?
So, is this still a problem 4 years later? I'm seeing this issue as well.