Browse Source

Don't crash when the HTTP request for getting the server status message fails.

statusmessagecrash
Christian Walther 11 years ago
parent
commit
8b62863419
  1. 12
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp

12
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp

@ -1250,6 +1250,7 @@ void StatusCallback(void *param)
{ {
static char data[256] = {0}; static char data[256] = {0};
DWORD bytesRead; DWORD bytesRead;
if(
WinHttpSendRequest( WinHttpSendRequest(
hRequest, hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS, WINHTTP_NO_ADDITIONAL_HEADERS,
@ -1258,15 +1259,18 @@ void StatusCallback(void *param)
0, 0,
0, 0,
0 0
); )
WinHttpReceiveResponse(hRequest, 0); && WinHttpReceiveResponse(hRequest, 0)
WinHttpReadData(hRequest, data, 255, &bytesRead); && WinHttpReadData(hRequest, data, 255, &bytesRead)
&& bytesRead
)
{
data[bytesRead] = 0; data[bytesRead] = 0;
if(bytesRead)
PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) data); PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) data);
} }
} }
} }
}
WinHttpCloseHandle(hRequest); WinHttpCloseHandle(hRequest);
WinHttpCloseHandle(hConnect); WinHttpCloseHandle(hConnect);
WinHttpCloseHandle(hSession); WinHttpCloseHandle(hSession);

Loading…
Cancel
Save