Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NPEs in TransportBroker.sendMessageToRouterService() : routerServiceMessenger #387

Closed
askirk opened this issue Jan 20, 2017 · 1 comment
Closed
Assignees

Comments

@askirk
Copy link
Contributor

askirk commented Jan 20, 2017

Stacktraces:

Fatal Exception: java.lang.NullPointerException
       at com.smartdevicelink.transport.TransportBroker.sendMessageToRouterService(SourceFile:92)
       at com.smartdevicelink.transport.TransportBroker.sendMessageToRouterService(SourceFile:79)
       at com.smartdevicelink.transport.TransportBroker.sendRegistrationMessage(SourceFile:7519)
       at com.smartdevicelink.transport.TransportBroker$1.onServiceConnected(SourceFile:65)
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.IBinder android.os.Messenger.getBinder()' on a null object reference
       at com.smartdevicelink.transport.TransportBroker.sendMessageToRouterService(SourceFile:98)
       at com.smartdevicelink.transport.TransportBroker.sendMessageToRouterService(SourceFile:79)
       at com.smartdevicelink.transport.TransportBroker.sendRegistrationMessage(SourceFile:7519)
       at com.smartdevicelink.transport.TransportBroker$1.onServiceConnected(SourceFile:65)

Occurs at https://github.com/smartdevicelink/sdl_android/blob/master/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java#L92

AND

https://github.com/smartdevicelink/sdl_android/blob/master/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java#L98

In both cases routerServiceMessenger is null. onServiceDisconnected() may be called called after the IF statement passes but before routerServiceMessenger is used.

@askirk
Copy link
Contributor Author

askirk commented Jan 20, 2017

We can't object lock inside of onServiceConnected an onServiceDisconnected callbacks, so I think simplest fix would be to catch NPE

@askirk askirk changed the title NPE in TransportBroker.sendMessageToRouterService() : routerServiceMessenger NPEs in TransportBroker.sendMessageToRouterService() : routerServiceMessenger Jan 20, 2017
@askirk askirk self-assigned this Jan 20, 2017
@askirk askirk closed this as completed Feb 22, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant