fix EndPoint null pointer

This commit is contained in:
raphaeIl
2024-04-01 16:41:42 -04:00
parent 40c053cf30
commit d6c07eb41d
3 changed files with 7 additions and 6 deletions

View File

@@ -22,7 +22,8 @@ namespace BLHX.Server.Game
readonly Task loopTask;
ushort packetIdx = 0;
private ushort NextPacketIdx => packetIdx;
public IPEndPoint EndPoint => (IPEndPoint?)tcpClient.Client.RemoteEndPoint ?? IPEndPoint.Parse("0.0.0.0:0");
public IPEndPoint EndPoint => tcpClient?.Client?.RemoteEndPoint as IPEndPoint ?? IPEndPoint.Parse("0.0.0.0:0");
public Connection(TcpClient tcpClient)
{

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@@ -8,7 +8,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>BLHX.Server.PcapParser</RootNamespace>
<AssemblyName>BLHX.Server.PcapParser</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>