From d32c5f1d61ff79c77ed8c0b2cb9386d3a8766d36 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Fri, 5 Jan 2024 21:30:11 -0800 Subject: [PATCH] fix show-ep3-maps action --- src/ServerState.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ServerState.cc b/src/ServerState.cc index b9f5c8e6..061f7ec1 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -1352,7 +1352,16 @@ void ServerState::load_ep3_data() { const string& tournament_state_filename = "system/ep3/tournament-state.json"; this->ep3_tournament_index = make_shared( this->ep3_map_index, this->ep3_com_deck_index, tournament_state_filename); - this->ep3_tournament_index->link_all_clients(this->shared_from_this()); + + shared_ptr s; + try { + s = this->shared_from_this(); + } catch (const bad_weak_ptr&) { + } + if (s) { + this->ep3_tournament_index->link_all_clients(s); + } + config_log.info("Loaded Episode 3 tournament state"); }