Guard against NULL Sockets

I’ve not been able to reproduce it always, but when using wxHTTP the internal socket was sometimes already closed. So just guard against crashes.
This commit is contained in:
Stefan Csomor
2020-11-30 18:49:38 +01:00
parent 14fb1c5fe1
commit fab9a67d23

View File

@@ -263,7 +263,8 @@ void wxSocketManagerMac::Install_Callback(wxSocketImpl *socket_,
{
wxSocketImplMac * const socket = static_cast<wxSocketImplMac *>(socket_);
CFSocketEnableCallBacks(socket->GetSocket(), GetCFCallback(socket, event));
if ( socket->GetSocket() )
CFSocketEnableCallBacks(socket->GetSocket(), GetCFCallback(socket, event));
}
void wxSocketManagerMac::Uninstall_Callback(wxSocketImpl *socket_,
@@ -271,7 +272,8 @@ void wxSocketManagerMac::Uninstall_Callback(wxSocketImpl *socket_,
{
wxSocketImplMac * const socket = static_cast<wxSocketImplMac *>(socket_);
CFSocketDisableCallBacks(socket->GetSocket(), GetCFCallback(socket, event));
if ( socket->GetSocket() )
CFSocketDisableCallBacks(socket->GetSocket(), GetCFCallback(socket, event));
}
// set the wxBase variable to point to CF wxSocketManager implementation so