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; readonly Task loopTask;
ushort packetIdx = 0; ushort packetIdx = 0;
private ushort NextPacketIdx => packetIdx; 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) public Connection(TcpClient tcpClient)
{ {

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>

View File

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