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)
|
public static void AddBuff(Mobile m, BuffInfo b)
|
||||||
{
|
{
|
||||||
if (m is PlayerMobile pm)
|
(m as PlayerMobile)?.AddBuff(b);
|
||||||
{
|
|
||||||
pm.AddBuff(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveBuff(Mobile m, BuffInfo b)
|
public static void RemoveBuff(Mobile m, BuffInfo b)
|
||||||
{
|
{
|
||||||
if (m is PlayerMobile pm)
|
(m as PlayerMobile)?.RemoveBuff(b);
|
||||||
{
|
|
||||||
pm.RemoveBuff(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveBuff(Mobile m, BuffIcon b)
|
public static void RemoveBuff(Mobile m, BuffIcon b)
|
||||||
{
|
{
|
||||||
if (m is PlayerMobile pm)
|
(m as PlayerMobile)?.RemoveBuff(b);
|
||||||
{
|
|
||||||
pm.RemoveBuff(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4640,12 +4640,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public void ResendBuffs()
|
public void ResendBuffs()
|
||||||
{
|
{
|
||||||
if (!BuffInfo.Enabled || m_BuffTable == null)
|
if (BuffInfo.Enabled && m_BuffTable != null && NetState?.BuffIcon == true)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NetState?.BuffIcon == true)
|
|
||||||
{
|
{
|
||||||
foreach (var info in m_BuffTable.Values)
|
foreach (var info in m_BuffTable.Values)
|
||||||
{
|
{
|
||||||
|
|
@ -4685,7 +4680,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public void RemoveBuff(BuffIcon b)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue