From a2d8293c04e3609d6d504b05d5b592b4dd83cd92 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 3 Oct 2021 13:31:56 +0200 Subject: [PATCH] Dont break if there's no debuggers attached. --- src/AngelscriptDebugger.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AngelscriptDebugger.cpp b/src/AngelscriptDebugger.cpp index 0d3ac74..026f35a 100644 --- a/src/AngelscriptDebugger.cpp +++ b/src/AngelscriptDebugger.cpp @@ -5,7 +5,6 @@ #include "DebugAdapterProtocol/Requests.hpp" void AngelscriptDebugger::Run(uint16_t port) { - // Listen on port 9012 _server = new asio::ip::tcp::acceptor(_ioContext, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), port)); std::thread([this]() { AcceptLoop(); }).detach(); } @@ -32,6 +31,9 @@ void AngelscriptDebugger::on_line_callback(asIScriptContext* ctx, AngelscriptDeb if (ctx->GetState() == asEXECUTION_SUSPENDED) { return; } + if (!d->HasDebuggerAttached()) { + return; + } const char* scriptSection = nullptr; int column = 0; int line = ctx->GetLineNumber(0, &column, &scriptSection); @@ -56,6 +58,9 @@ size_t GetBreakpointHash(const std::string& section, size_t line) { } void AngelscriptDebugger::on_exception_callback(asIScriptContext* ctx, AngelscriptDebugger* d) { + if (!d->HasDebuggerAttached()) { + return; + } ctx->Suspend(); d->_pausedContexts.push_back(ctx);