fix: Fixes leaking/errors caused by categorization (#1404)

### Summary
- [X] Fixes 4 TormentedMinotaur created at `(0, 0, 0) [null]` when `[add` is used.
- [X] Fixes client crash from a bug in HouseRaffleStone when `[add` is used.

Recommend viewing with [_whitespace disabled_](https://github.com/modernuo/ModernUO/pull/1404/files?diff=split&w=1)
This commit is contained in:
Kamron Batman 2023-05-19 18:41:31 -07:00 • committed by GitHub
parent f92d821168
commit 35237ff7d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 262 additions and 220 deletions

View file

@ -65,7 +65,7 @@ public partial class HouseRaffleStone : Item
public static readonly TimeSpan ExpirationTime = TimeSpan.FromDays(30.0); // Time a person has to use the stone to place the house
private static Timer _allStonesTimer;
private static HashSet<HouseRaffleStone> _allStones = null;
private static HashSet<HouseRaffleStone> _allStones;
private HouseRaffleRegion _region;
@ -227,9 +227,7 @@ public partial class HouseRaffleStone : Item
private static void RemoveRaffleStone(HouseRaffleStone stone)
{
_allStones.Remove(stone);
if (_allStones.Count == 0)
if (_allStones?.Remove(stone) == true && _allStones.Count == 0)
{
_allStonesTimer.Stop();
_allStonesTimer = null;