martinohanlon / BlueDot

A zero boiler plate bluetooth remote
MIT License
143 stars 44 forks source link

Android - Null pointer exception - if a socket cant be opened #123

Closed martinohanlon closed 4 years ago

martinohanlon commented 5 years ago

A null pointer exception is raised here https://github.com/martinohanlon/BlueDot/blob/master/clients/android/app/src/main/java/com/stuffaboutcode/bluedot/BluetoothChatService.java#L426

if mmSocket is null because it failed to be created in the constructor here https://github.com/martinohanlon/BlueDot/blob/master/clients/android/app/src/main/java/com/stuffaboutcode/bluedot/BluetoothChatService.java#L400

This issue was reported as an ANR from google play.

No idea why it happens but the run method should test to see if mmSocket is null and call connectionFailed.

martinohanlon commented 4 years ago

in dev and ready