datso / react-native-pjsip

A PJSIP module for React Native.
http://datso.github.io/react-native-pjsip
GNU General Public License v3.0
273 stars 233 forks source link

Null Pointer Exception when closing app #33

Closed james-ovens closed 6 years ago

james-ovens commented 7 years ago

Once the PjSip Service has been started if at any time after that point the app is closed from the Recent Apps screen then a Null Pointer Exception occurs in the PjSipService.onStartCommand method, Line 240. From logcat:

10-17 13:28:51.456 5903 5903 E AndroidRuntime: java.lang.RuntimeException: Unable to start service com.carusto.ReactNativePjSip.PjSipService@ced8a84 with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4079) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at android.app.ActivityThread.access$2400(ActivityThread.java:221) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1897) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at android.os.Looper.loop(Looper.java:158) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7224) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at com.carusto.ReactNativePjSip.PjSipService.onStartCommand(PjSipService.java:240) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4062) 10-17 13:28:51.456 5903 5903 E AndroidRuntime: ... 8 more

james-ovens commented 7 years ago

Seems like this would be fixed by: https://github.com/Carusto/react-native-pjsip/pull/29

datso commented 6 years ago

@james-ovens Please use the latest version of the master. This issue should be fixed.