summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Kirk <askirk@umich.edu>2017-01-25 13:55:46 -0500
committerAustin Kirk <askirk@umich.edu>2017-01-25 13:55:46 -0500
commit8487150d5f87630c3a0d3700dc0c644d7442308c (patch)
tree0e3d7b146d3a1e92232ec3a72a6cce7ea1faf467
parent7b8a0c35cc6c202008d8eeb8b7fd2c8b37270578 (diff)
downloadsdl_android-8487150d5f87630c3a0d3700dc0c644d7442308c.tar.gz
Add condition in catch clause
We don’t want to try and access routerServiceMessenger if it is null, so let’s check if we got an NPE, and short out if we did.
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java b/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java
index f73f51262..f3ccb43c4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java
@@ -94,8 +94,8 @@ public class TransportBroker {
} catch (RemoteException|NullPointerException e) { // NPE is STRICTLY for case that routerServiceMessenger is null
e.printStackTrace();
//Let's check to see if we should retry
- if(e instanceof TransactionTooLargeException
- || (retryCount<5 && routerServiceMessenger.getBinder().isBinderAlive() && routerServiceMessenger.getBinder().pingBinder())){ //We probably just failed on a small transaction =\
+ if(!(e instanceof NullPointerException) && (e instanceof TransactionTooLargeException
+ || (retryCount<5 && routerServiceMessenger.getBinder().isBinderAlive() && routerServiceMessenger.getBinder().pingBinder()))){ //We probably just failed on a small transaction =\
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
@@ -103,7 +103,7 @@ public class TransportBroker {
}
return sendMessageToRouterService(message, retryCount++);
}else{
- //DeadObject, time to kill our connection
+ //DeadObject or routerServiceMessenger is null, time to kill our connection
Log.d(TAG, "Dead object while attempting to send packet");
routerServiceMessenger = null;
registeredWithRouterService = false;