From aa4e289cc8267e282a98b06aa891bca6c0669f89 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 20 Sep 2018 21:27:13 -0400 Subject: [PATCH] bugfix google translate --- extensions/googletranslate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/googletranslate.cpp b/extensions/googletranslate.cpp index 808fcaa..a59f4dc 100644 --- a/extensions/googletranslate.cpp +++ b/extensions/googletranslate.cpp @@ -53,7 +53,8 @@ bool ProcessSentence(std::wstring& sentence, const InfoForExtension* miscInfo) char buffer[100000] = {}; // Google Translate page is ~64kb WinHttpReceiveResponse(request, NULL); WinHttpReadData(request, buffer, 100000, &bytesRead); - TKK = strtoll(strstr(buffer, "a\\x3d") + 5, nullptr, 10) + strtoll(strstr(buffer, "b\\x3d") + 5, nullptr, 10); + if (strstr(buffer, "a\\x3d")) TKK = strtoll(strstr(buffer, "a\\x3d") + 5, nullptr, 10) + strtoll(strstr(buffer, "b\\x3d") + 5, nullptr, 10); + else TKK = strtoll(strstr(buffer, "TKK") + 12, nullptr, 10); } WinHttpCloseHandle(request); }