From b4150841ec9aa4fcaa9210be42138bac4298c075 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 10 May 2025 00:35:34 +0100 Subject: [PATCH] Try to ensure we only have use Stats instance. This probably only happens when a user has a broken database but its best to be more robust. --- modules/operserv/os_stats.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/operserv/os_stats.cpp b/modules/operserv/os_stats.cpp index 15287bffa..015801fc1 100644 --- a/modules/operserv/os_stats.cpp +++ b/modules/operserv/os_stats.cpp @@ -19,7 +19,8 @@ struct Stats final Stats() : Serializable("Stats") { - me = this; + if (!me) + me = this; } }; @@ -45,7 +46,7 @@ struct StatsType final } }; -Stats *Stats::me; +Stats *Stats::me = nullptr; /** * Count servers connected to server s @@ -340,7 +341,7 @@ public: void OnUserConnect(User *u, bool &exempt) override { if (UserListByNick.size() == MaxUserCount && Anope::CurTime == MaxUserTime) - stats_saver.QueueUpdate(); + Stats::me->QueueUpdate(); } };