diff options
| author | Sadie Powell <sadie@witchery.services> | 2025-05-10 00:35:34 +0100 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2025-05-10 00:54:39 +0100 |
| commit | b4150841ec9aa4fcaa9210be42138bac4298c075 (patch) | |
| tree | 4d373831f4eb9c805bc0f710478d98fcd7abc658 | |
| parent | eec428b0c7e6dd05c67df35d973b19cc1c2cf4b7 (diff) | |
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.
| -rw-r--r-- | modules/operserv/os_stats.cpp | 7 |
1 files 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(); } }; |
