Fixes null propogation

This commit is contained in:
Kamron Batman 2018-09-14 13:49:23 -07:00
parent 22ab83ea9e
commit 3c9842ee5a
218 changed files with 799 additions and 1458 deletions

View file

@ -151,8 +151,7 @@ namespace Server.Engines.Doom
ClearTraps();
DestroyRegion();
if ( m_Timer != null )
m_Timer.Stop();
m_Timer?.Stop();
m_Timer = null;
}
@ -194,8 +193,7 @@ namespace Server.Engines.Doom
public virtual void DestroyRegion()
{
if ( m_Region != null )
m_Region.Unregister();
m_Region?.Unregister();
m_Region = null;
}

View file

@ -146,10 +146,7 @@ namespace Server.Engines.Doom
NukeItemList( m_Statues );
NukeItemList( m_Levers );
if ( m_LampRoom != null )
{
m_LampRoom.Unregister();
}
m_LampRoom?.Unregister();
if ( m_Tiles != null )
{
foreach( Region region in m_Tiles )
@ -181,12 +178,9 @@ namespace Server.Engines.Doom
{
LeverPuzzleRegion region = (LeverPuzzleRegion)m_Tiles[index];
if ( region != null )
if ( region?.Occupant != null && region.Occupant.Alive )
{
if ( region.Occupant != null && region.Occupant.Alive )
{
return (PlayerMobile)region.Occupant;
}
return (PlayerMobile)region.Occupant;
}
return null;
}