Fixed crash on attempt to send stats without network connection

https://forum.zdoom.org/viewtopic.php?t=59844
This commit is contained in:
alexey.lysiuk 2018-03-17 22:38:41 +02:00
parent b4d3715345
commit ecff13ac2e

View file

@ -57,6 +57,11 @@ bool I_HTTPRequest(const char* request)
SOCKET Socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct hostent *host;
host = gethostbyname(sys_statshost.GetHumanString());
if (host == nullptr)
{
DPrintf(DMSG_ERROR, "Error looking up hostname.\n");
return false;
}
SOCKADDR_IN SockAddr;
SockAddr.sin_port = htons(sys_statsport);
SockAddr.sin_family = AF_INET;