Browse Source

Fix NRE when calling GetSockName before Bind (#6206)

gdkchan 2 years ago
parent
commit
30bdc4544e
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs

+ 8 - 1
src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs

@@ -121,7 +121,14 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
         {
             IPEndPoint endPoint = isRemote ? socket.RemoteEndPoint : socket.LocalEndPoint;
 
-            context.Memory.Write(bufferPosition, BsdSockAddr.FromIPEndPoint(endPoint));
+            if (endPoint != null)
+            {
+                context.Memory.Write(bufferPosition, BsdSockAddr.FromIPEndPoint(endPoint));
+            }
+            else
+            {
+                context.Memory.Write(bufferPosition, new BsdSockAddr());
+            }
         }
 
         [CommandCmif(0)]