We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7555935 commit 36cc209Copy full SHA for 36cc209
src/com/codebutler/android_websockets/WebSocketClient.java
@@ -150,14 +150,16 @@ public void disconnect() {
150
mHandler.post(new Runnable() {
151
@Override
152
public void run() {
153
- try {
154
- mSocket.close();
+ if (mSocket != null) {
+ try {
155
+ mSocket.close();
156
+ } catch (IOException ex) {
157
+ Log.d(TAG, "Error while disconnecting", ex);
158
+ mListener.onError(ex);
159
+ }
160
mSocket = null;
- mConnected = false;
- } catch (IOException ex) {
- Log.d(TAG, "Error while disconnecting", ex);
- mListener.onError(ex);
161
}
162
+ mConnected = false;
163
164
});
165
0 commit comments