Fixes a crash when closing a socket

This commit is contained in:
Sepalani 2017-02-01 00:11:19 +00:00
parent 1603191145
commit 3fd08b6cee

View file

@ -615,9 +615,13 @@ s32 WiiSockMan::NewSocket(s32 af, s32 type, s32 protocol)
s32 WiiSockMan::DeleteSocket(s32 s)
{
s32 ReturnValue = EBADF;
auto socket_entry = WiiSockets.find(s);
s32 ReturnValue = socket_entry->second.CloseFd();
WiiSockets.erase(socket_entry);
if (socket_entry != WiiSockets.end())
{
ReturnValue = socket_entry->second.CloseFd();
WiiSockets.erase(socket_entry);
}
return ReturnValue;
}