From c8966122a67285d863c6963c14e013fdf807e27b Mon Sep 17 00:00:00 2001 From: staphen Date: Mon, 30 May 2022 17:39:20 -0400 Subject: [PATCH] Check if dthread is running before locking mutex --- Source/dthread.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/dthread.cpp b/Source/dthread.cpp index ab12b5ae8..2572562d9 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -60,6 +60,9 @@ void DthreadHandler() void dthread_remove_player(uint8_t pnum) { + if (!DthreadRunning) + return; + std::lock_guard lock(*DthreadMutex); InfoList.remove_if([&](auto &pkt) { return pkt.pnum == pnum; @@ -68,7 +71,7 @@ void dthread_remove_player(uint8_t pnum) void dthread_send_delta(int pnum, _cmd_id cmd, std::unique_ptr data, uint32_t len) { - if (!gbIsMultiplayer) + if (!gbIsMultiplayer || !DthreadRunning) return; DThreadPkt pkt { pnum, cmd, std::move(data), len };