wn-na / react-native-capture-protection

It’s a library for React Native to control simple capture events(i.e. Screenshot or Screen record)
https://www.npmjs.com/package/react-native-capture-protection
MIT License
102 stars 10 forks source link

NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference in react-native-capture-protection #55

Open TechLead18 opened 1 week ago

TechLead18 commented 1 week ago

I am encountering a NullPointerException in react-native-capture-protection on Android 14 devices. The error occurs when attempting to invoke getClass() on a null object. This issue is being reported in Sentry, and it seems to originate from getScreenCaptureCallback() in CaptureProtectionModule.

Environment: React Native Version: 0.75.2 react-native-capture-protection Version: 1.9.12 Android Version: 14

Error Message:

NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference

Stack Trace:

com.captureprotection.CaptureProtectionModule in getScreenCaptureCallback at line 12
com.captureprotection.CaptureProtectionModule in addListener at line 1
com.captureprotection.CaptureProtectionModule in addScreenshotListener
java.lang.reflect.Method in invoke
com.facebook.react.bridge.JavaMethodWrapper in invoke at line 168
com.facebook.react.bridge.JavaModuleWrapper in invoke at line 19
com.facebook.jni.NativeRunnable in run
android.os.Handler in handleCallback at line 1013
android.os.Handler in dispatchMessage at line 101
com.facebook.react.bridge.queue.MessageQueueThreadHandler in dispatchMessage
android.os.Looper in loopOnce at line 226
android.os.Looper in loop at line 328
com.facebook.react.bridge.queue.MessageQueueThreadImpl$4 in run at line 37
java.lang.Thread in run at line 1012
wn-na commented 6 days ago

@TechLead18 thanks for report. i fixed it for v1.9.13. can you try it?

TechLead18 commented 4 days ago

@TechLead18 thanks for report. i fixed it for v1.9.13. can you try it?

i will try. thank you