From b74e9f47bbdec0b8c7af4a748efa57118a79f023 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Fri, 17 Feb 2017 22:54:30 +0100 Subject: [PATCH] Don't crash when the HTTP request for getting the server status message fails. Same thing as 82d9c3a57879, more or less. --- .../Sources/Plasma/Apps/plUruLauncher/Main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp index 51b02703..b5f3896e 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp @@ -668,7 +668,7 @@ static void HttpRequestGet(HINTERNET hConnect) const wchar *path = BuildTypeServerStatusPath(); HINTERNET hRequest = 0; char data[256] = {0}; - DWORD bytesRead; + DWORD bytesRead = 0; hRequest = WinHttpOpenRequest( hConnect, @@ -693,9 +693,11 @@ static void HttpRequestGet(HINTERNET hConnect) if(b) { DWORD err = GetLastError(); - WinHttpReceiveResponse(hRequest, 0); - WinHttpReadData(hRequest, data, arrsize(data)-1, &bytesRead); - data[bytesRead] = 0; + if (WinHttpReceiveResponse(hRequest, 0) + && WinHttpReadData(hRequest, data, arrsize(data) - 1, &bytesRead)) + { + data[bytesRead] = 0; + } } } if(bytesRead)