fix: Fixes crash with antimacro code (#1415)

This commit is contained in:
Kamron Batman 2023-06-23 17:10:47 -07:00 committed by GitHub
parent c93fa004a3
commit db4b01567f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -202,8 +202,8 @@ public static class AntiMacroSystem
_antiMacroTable ??= new Dictionary<Mobile, PlayerAntiMacro>();
// Hot path so use optimized code
ref PlayerAntiMacro antiMacro = ref CollectionsMarshal.GetValueRefOrNullRef(_antiMacroTable, pm);
if (Unsafe.IsNullRef(ref antiMacro))
ref PlayerAntiMacro antiMacro = ref CollectionsMarshal.GetValueRefOrAddDefault(_antiMacroTable, pm, out var exists);
if (!exists)
{
antiMacro = new PlayerAntiMacro();
}