diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-08-09 23:59:23 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-08-09 23:59:23 +0300 |
commit | e7821f1b4df1b88d84bf3ac1573c5c2518e4a57e (patch) | |
tree | 5a464e9985433a7719f6f4353f375e9a93fb4b55 /indra/newview | |
parent | dc1d8031f1cd08ed0291be1918dcf6df3364c7f4 (diff) |
SL-15789 Crash in LLTranslationAPIHandler
Bugsplat logged an out_of_range exception for unknown string
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lltranslate.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 553a3cd086..a2c696c762 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -197,6 +197,11 @@ void LLTranslationAPIHandler::translateMessageCoro(LanguagePair_t fromTo, std::s LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts, httpHeaders); + if (LLApp::isQuitting()) + { + return; + } + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -207,7 +212,22 @@ void LLTranslationAPIHandler::translateMessageCoro(LanguagePair_t fromTo, std::s const LLSD::Binary &rawBody = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); std::string body(rawBody.begin(), rawBody.end()); - if (this->parseResponse(parseResult, body, translation, detected_lang, err_msg)) + bool res = false; + + try + { + res = this->parseResponse(parseResult, body, translation, detected_lang, err_msg); + } + catch (std::out_of_range&) + { + LL_WARNS() << "Out of range exception on string " << body << LL_ENDL; + } + catch (...) + { + LOG_UNHANDLED_EXCEPTION( "Exception on string " + body ); + } + + if (res) { // Fix up the response LLStringUtil::replaceString(translation, "<", "<"); |