summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Heike <t.heike@codeelements.de>2016-07-07 19:08:39 +0200
committerGitHub <noreply@github.com>2016-07-07 19:08:39 +0200
commit96c5173ba8269d8cb0e84c517186d12b5817b8ac (patch)
tree0b6e3330f9de18e11f9774b62aad3c3ccd83ffd8
parent023e618ef802441e5de71c5723c5a17da798e25c (diff)
downloadsdl_android-96c5173ba8269d8cb0e84c517186d12b5817b8ac.tar.gz
Fixed ClassCastException in openConnection
From the crash reports in PlayStore I receive some ClassCastExceptions every now and then on devices (seems to be exclusive to tablets) running Android 4.1 and 4.2. The exceptions occur in BTTransport.openConnection when some exception is cast to SdlException. The reports contain no line numbers ... I suspect line 190 to be the cause of the error, since this is the only line containing an unchecked cast to SdlException.
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
index e41c501e5..f64ff3668 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
@@ -187,7 +187,7 @@ public class BTTransport extends SdlTransport {
throw new SdlException("Bluetooth adapter must be on to instantiate a SdlProxy object.", SdlExceptionCause.BLUETOOTH_DISABLED);
}
- if(((SdlException) ex).getSdlExceptionCause() == SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE) {
+ if(ex instanceof SdlException && ((SdlException) ex).getSdlExceptionCause() == SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE) {
SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Could not open connection to SDL.", SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE);