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);