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

@ -76,9 +76,9 @@ namespace Server.SkillHandlers
targ.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042666, from.NetState ); // You can not quite get a sense of their physical characteristics.
}
}
else if ( targeted is Item )
else
{
((Item)targeted).SendLocalizedMessageTo( from, 500323, "" ); // Only living things have anatomies!
(targeted as Item)?.SendLocalizedMessageTo( @from, 500323, "" ); // Only living things have anatomies!
}
}
}

View file

@ -202,8 +202,7 @@ namespace Server.SkillHandlers
creature.BardPacified = false;
if ( creature.AIObject != null )
creature.AIObject.DoMove( creature.Direction );
creature.AIObject?.DoMove( creature.Direction );
if ( from is PlayerMobile && !(( (PlayerMobile)from ).HonorActive || TransformationSpellHelper.UnderTransformation( from, typeof( EtherealVoyageSpell ))))
creature.Combatant = from;

View file

@ -117,8 +117,7 @@ namespace Server.SkillHandlers
if ( ends && info.m_Ending && info.m_EndTime < DateTime.UtcNow )
{
if ( info.m_Timer != null )
info.m_Timer.Stop();
info.m_Timer?.Stop();
info.Clear();
m_Table.Remove( targ );

View file

@ -78,9 +78,9 @@ namespace Server.SkillHandlers
targ.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1038166 + (body / 11), from.NetState ); // You cannot judge his/her/its mental abilities.
}
}
else if ( targeted is Item )
else
{
((Item)targeted).SendLocalizedMessageTo( from, 500908, "" ); // It looks smarter than a rock, but dumber than a piece of wood.
(targeted as Item)?.SendLocalizedMessageTo( @from, 500908, "" ); // It looks smarter than a rock, but dumber than a piece of wood.
}
}
}

View file

@ -113,8 +113,8 @@ namespace Server.SkillHandlers
from.SendLocalizedMessage( 502372 ); // You fail to disarm the trap... but you don't set it off
}
if ( !isOwner && kit != null )
kit.ConsumeCharge( from );
if ( !isOwner )
kit?.ConsumeCharge( @from );
}
}
else