Merge pull request #4795 from sepalani/fix_sock

Fixes a crash when closing a socket
This commit is contained in:
Mat M 2017-01-31 20:30:26 -05:00 committed by GitHub
commit 5b782b9f2d

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;
}