diff --git a/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt b/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt index 747a741f5..2b5a1c11b 100644 --- a/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt +++ b/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt @@ -42,9 +42,13 @@ class SourceDebugWebSocket(handshakeRequest: NanoHTTPD.IHTTPSession) : } override fun onMessage(message: NanoWSD.WebSocketFrame) { - if (!message.textPayload.isJson()) return launch(IO) { kotlin.runCatching { + if (!message.textPayload.isJson()) { + send("数据必须为Json格式") + close(NanoWSD.WebSocketFrame.CloseCode.NormalClosure, "调试结束", false) + return@launch + } val debugBean = GSON.fromJsonObject>(message.textPayload) if (debugBean != null) { val tag = debugBean["tag"]