Fixes BuffIcon is NPE (#259)
- [X] Fixes BuffIconTable accessed while null
This commit is contained in:
parent
e9c1e4cbba
commit
fd9ec089f7
2 changed files with 5 additions and 19 deletions
|
|
@ -131,26 +131,17 @@ namespace Server
|
|||
|
||||
public static void AddBuff(Mobile m, BuffInfo b)
|
||||
{
|
||||
if (m is PlayerMobile pm)
|
||||
{
|
||||
pm.AddBuff(b);
|
||||
}
|
||||
(m as PlayerMobile)?.AddBuff(b);
|
||||
}
|
||||
|
||||
public static void RemoveBuff(Mobile m, BuffInfo b)
|
||||
{
|
||||
if (m is PlayerMobile pm)
|
||||
{
|
||||
pm.RemoveBuff(b);
|
||||
}
|
||||
(m as PlayerMobile)?.RemoveBuff(b);
|
||||
}
|
||||
|
||||
public static void RemoveBuff(Mobile m, BuffIcon b)
|
||||
{
|
||||
if (m is PlayerMobile pm)
|
||||
{
|
||||
pm.RemoveBuff(b);
|
||||
}
|
||||
(m as PlayerMobile)?.RemoveBuff(b);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4640,12 +4640,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void ResendBuffs()
|
||||
{
|
||||
if (!BuffInfo.Enabled || m_BuffTable == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (NetState?.BuffIcon == true)
|
||||
if (BuffInfo.Enabled && m_BuffTable != null && NetState?.BuffIcon == true)
|
||||
{
|
||||
foreach (var info in m_BuffTable.Values)
|
||||
{
|
||||
|
|
@ -4685,7 +4680,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void RemoveBuff(BuffIcon b)
|
||||
{
|
||||
if (!m_BuffTable.Remove(b, out var info))
|
||||
if (m_BuffTable == null || !m_BuffTable.Remove(b, out var info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue