diff --git a/extensions/googletranslate.cpp b/extensions/googletranslate.cpp index f7d0290..d748ac4 100644 --- a/extensions/googletranslate.cpp +++ b/extensions/googletranslate.cpp @@ -80,9 +80,12 @@ extern "C" WinHttpReceiveResponse(request, NULL); WinHttpReadData(request, buffer, 10000, &bytesRead); // Response formatted as JSON: starts with '[[["' - MultiByteToWideChar(CP_UTF8, 0, buffer + 4, (int)((strstr(buffer, "\",\"")) - (buffer + 4)), translation, 10000); - message = translation; - for (int i = -1; translation[++i];) if (translation[i] == L'\\') translation[i] = 0x200b; + if (buffer[0] == '[') + { + MultiByteToWideChar(CP_UTF8, 0, buffer + 4, (int)((strstr(buffer, "\",\"")) - (buffer + 4)), translation, 10000); + message = translation; + for (int i = -1; translation[++i];) if (translation[i] == L'\\') translation[i] = 0x200b; + } } WinHttpCloseHandle(request); }