mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-05 09:48:58 +02:00
misc: chore: Fix possible NullReferenceExceptions, InvalidOperationExceptions
This commit is contained in:
+1
-1
@@ -1099,7 +1099,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
|
||||
}
|
||||
if (!IPAddress.TryParse(ldnServer, out IPAddress ipAddress))
|
||||
{
|
||||
ipAddress = Dns.GetHostEntry(ldnServer).AddressList[0];
|
||||
ipAddress = Dns.GetHostEntry(ldnServer ?? string.Empty).AddressList[0];
|
||||
}
|
||||
NetworkClient = new LdnMasterProxyClient(ipAddress.ToString(), LanPlayPort, context.Device.Configuration);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
|
||||
// Attempt to find matching configuration. If we don't find one, wait for a bit and try again.
|
||||
// Woken by new tokens coming in from the master server.
|
||||
|
||||
IPAddress address = (session.Socket.RemoteEndPoint as IPEndPoint).Address;
|
||||
IPAddress address = (session.Socket.RemoteEndPoint as IPEndPoint)?.Address;
|
||||
byte[] addressBytes = ProxyHelpers.AddressTo16Byte(address);
|
||||
|
||||
long time;
|
||||
@@ -282,7 +282,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
|
||||
// Allow any client that has a private IP to connect. (indicated by the server as all 0 in the token)
|
||||
|
||||
bool isPrivate = waitToken.PhysicalIp.AsSpan().SequenceEqual(new byte[16]);
|
||||
bool ipEqual = isPrivate || waitToken.AddressFamily == address.AddressFamily && waitToken.PhysicalIp.AsSpan().SequenceEqual(addressBytes);
|
||||
bool ipEqual = address != null && (isPrivate || waitToken.AddressFamily == address.AddressFamily && waitToken.PhysicalIp.AsSpan().SequenceEqual(addressBytes));
|
||||
|
||||
if (ipEqual && waitToken.Token.AsSpan().SequenceEqual(config.Token.AsSpan()))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user