Skip to content

Potential NullPointerException in hasPermissions #305

@geraintwhite

Description

@geraintwhite

Bug report

  • Reproduced on:
  • Android
  • iOS

Description

I haven't encountered this crash myself, but looking at the Google Play developer console for my app I can see the exception occurs semi-frequently.

image

It looks like it is cause when ContextCompat.checkSelfPermission(currentActivity, permission); is called here and currentActivity is null.

A simple null check will probably do the trick.

Versions

- Callkeep: 3.1.1
- React Native: 0.59.10
- Android: 8/9/10
- Phone model: Galaxy S8, Galaxy A20e, Galaxy A70, Acer Liquid S1

Logs

java.lang.NullPointerException: 
  at android.support.v4.content.ContextCompat.checkSelfPermission (ContextCompat.java:544)
  at io.wazo.callkeep.RNCallKeepModule.hasPermissions (RNCallKeepModule.java:513)
  at io.wazo.callkeep.RNCallKeepModule.startCall (RNCallKeepModule.java:184)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:158)
  at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:29)
  at android.os.Looper.loop (Looper.java:214)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:232)
  at java.lang.Thread.run (Thread.java:764)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions