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
1 changed files with 6 additions and 2 deletions

View File

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