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 8b18d1179..38d46fa6d 100644 --- a/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt +++ b/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt @@ -48,10 +48,8 @@ class SourceDebugWebSocket(handshakeRequest: NanoHTTPD.IHTTPSession) : val tag = debugBean["tag"] val key = debugBean["key"] if (tag.isNullOrBlank() || key.isNullOrBlank()) { - kotlin.runCatching { - send(App.INSTANCE.getString(R.string.cannot_empty)) - close(NanoWSD.WebSocketFrame.CloseCode.NormalClosure, "调试结束", false) - } + send(App.INSTANCE.getString(R.string.cannot_empty)) + close(NanoWSD.WebSocketFrame.CloseCode.NormalClosure, "调试结束", false) return } App.db.bookSourceDao.getBookSource(tag)?.let { @@ -75,6 +73,7 @@ class SourceDebugWebSocket(handshakeRequest: NanoHTTPD.IHTTPSession) : send(msg) if (state == -1 || state == 1000) { Debug.cancelDebug(true) + close(NanoWSD.WebSocketFrame.CloseCode.NormalClosure, "调试结束", false) } } }