mirror of
https://github.com/GittyMac/A1Emu.git
synced 2026-08-22 09:04:10 -05:00
Prevent crashes when connection ID doesn't exist.
This commit is contained in:
@@ -7,17 +7,22 @@ using NetCoreServer;
|
||||
public class A1_Sender {
|
||||
|
||||
public void SendToUser(TcpServer sendingServer, string guid, string message){
|
||||
TcpSession session = sendingServer.FindSession(new Guid(guid));
|
||||
try
|
||||
{
|
||||
TcpSession session = sendingServer.FindSession(new Guid(guid));
|
||||
|
||||
List<byte[]> d = new List<byte[]>();
|
||||
Byte[] reply = Encoding.ASCII.GetBytes(message);
|
||||
byte[] b2 = new byte[] {0x00};
|
||||
d.Add(reply);
|
||||
d.Add(b2);
|
||||
byte[] b3 = d.SelectMany(a => a).ToArray();
|
||||
List<byte[]> d = new List<byte[]>();
|
||||
Byte[] reply = Encoding.ASCII.GetBytes(message);
|
||||
byte[] b2 = new byte[] {0x00};
|
||||
d.Add(reply);
|
||||
d.Add(b2);
|
||||
byte[] b3 = d.SelectMany(a => a).ToArray();
|
||||
|
||||
Console.WriteLine(message);
|
||||
session?.Send(b3, 0, b3.Length);
|
||||
Console.WriteLine(message);
|
||||
session?.Send(b3, 0, b3.Length);
|
||||
}catch(System.FormatException){
|
||||
Console.WriteLine("[Error] Couldn't send to user...");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user