0xZhangKe / WebSocketDemo

用于简化 WebSocket 在 Android 平台使用的封装方法
Other
817 stars 144 forks source link

关闭连接时的空指针异常NPE #66

Closed CongDuang closed 4 months ago

CongDuang commented 2 years ago
06-22 10:03:52.765 30961 5704 E AndroidRuntime: FATAL EXCEPTION: WebSocketWriteThread-3097
1106-22 10:03:52.765 30961 5704 E AndroidRuntime: Process: com.tanikawa.xuannaer, PID: 30961
1206-22 10:03:52.765 30961 5704 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.net.Socket.close()' on a null object reference
1306-22 10:03:52.765 30961 5704 E AndroidRuntime: at org.java_websocket.client.WebSocketClient$WebsocketWriteThread.closeSocket(WebSocketClient.java:693)
1406-22 10:03:52.765 30961 5704 E AndroidRuntime: at org.java_websocket.client.WebSocketClient$WebsocketWriteThread.run(WebSocketClient.java:662)
1506-22 10:03:52.765 30961 5704 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)
1606-22 10:03:52.805 30961 5704 E CrashHandler: In thread: Thread[WebSocketWriteThread-3097,5,main]
1706-22 10:03:52.805 30961 5704 E CrashHandler: UncaughtException detected: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.net.Socket.close()' on a null object reference
1806-22 10:03:52.805 30961 5704 E CrashHandler: at org.java_websocket.client.WebSocketClient$WebsocketWriteThread.closeSocket(WebSocketClient.java:693)
1906-22 10:03:52.805 30961 5704 E CrashHandler: at org.java_websocket.client.WebSocketClient$WebsocketWriteThread.run(WebSocketClient.java:662)
2006-22 10:03:52.805 30961 5704 E CrashHandler: at java.lang.Thread.run(Thread.java:764)
paker369 commented 1 year ago

怎么解决的