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

@ -133,8 +133,7 @@ namespace Server.Engines.Chat
}
else
{
if ( user.CurrentChannel != null )
user.CurrentChannel.RemoveUser( user ); // Remove them from their current channel first
user.CurrentChannel?.RemoveUser( user ); // Remove them from their current channel first
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.JoinedChannel, m_Name );
@ -226,8 +225,8 @@ namespace Server.Engines.Chat
SendMessage( 44, user.Username ) ; // %1 has been kicked out of the conference.
}
if ( wasBanned && moderator != null )
moderator.SendMessage( 62, user.Username ); // You are banning %1 from this conference.
if ( wasBanned )
moderator?.SendMessage( 62, user.Username ); // You are banning %1 from this conference.
}
public bool VoiceRestricted

View file

@ -33,8 +33,7 @@ namespace Server.Engines.Chat
public static void SendCommandTo( Mobile to, ChatCommand type, string param1, string param2 )
{
if ( to != null )
to.Send( new ChatMessagePacket( null, (int)type + 20, param1, param2 ) );
to?.Send( new ChatMessagePacket( null, (int)type + 20, param1, param2 ) );
}
public static void OpenChatWindowRequest( NetState state, PacketReader pvSrc )
@ -57,8 +56,7 @@ namespace Server.Engines.Chat
if ( acct != null )
accountChatName = acct.GetTag( "ChatName" );
if ( accountChatName != null )
accountChatName = accountChatName.Trim();
accountChatName = accountChatName?.Trim();
if ( accountChatName != null && accountChatName.Length > 0 )
{
@ -96,8 +94,7 @@ namespace Server.Engines.Chat
accountChatName = chatName;
if ( acct != null )
acct.AddTag( "ChatName", chatName );
acct?.AddTag( "ChatName", chatName );
}
else
{

View file

@ -175,8 +175,7 @@ namespace Server.Engines.Chat
}
}
if ( password != null )
password = password.Trim();
password = password?.Trim();
if ( password != null && password.Length == 0 )
password = null;
@ -213,8 +212,7 @@ namespace Server.Engines.Chat
name = param;
}
if ( password != null )
password = password.Trim();
password = password?.Trim();
if ( password != null && password.Length == 0 )
password = null;

View file

@ -190,8 +190,7 @@ namespace Server.Engines.Chat
{
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.CloseChatWindow );
if ( user.m_Channel != null )
user.m_Channel.RemoveUser( user );
user.m_Channel?.RemoveUser( user );
m_Users.Remove( user );
m_Table.Remove( user.m_Mobile );