From 18bacca5ca066c6fb1b38a82e322b624923b7340 Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Tue, 24 Mar 2015 18:30:40 +0200
Subject: [PATCH] MAINT-5023 URIparser crash in
 LLUrlEntryBase::urlToLabelWithGreyQuery

---
 indra/llcommon/lluriparser.cpp | 12 ++++++++++++
 indra/newview/llstartup.cpp    |  6 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp
index d07288f1239..08b19c56e0f 100644
--- a/indra/llcommon/lluriparser.cpp
+++ b/indra/llcommon/lluriparser.cpp
@@ -118,6 +118,12 @@ void LLUriParser::fragment(const std::string& s)
 
 void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str)
 {
+	if(&textRange == NULL)
+	{
+		LL_WARNS() << "textRange is NULL for uri: " << mNormalizedUri << LL_ENDL;
+		return;
+	}
+
 	S32 len = textRange.afterLast - textRange.first;
 	if (len)
 	{
@@ -128,6 +134,12 @@ void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str)
 
 void LLUriParser::extractParts()
 {
+	if(&mUri == NULL)
+	{
+		LL_WARNS() << "mUri is NULL for uri: " << mNormalizedUri << LL_ENDL;
+		return;
+	}
+
 	if (mTmpScheme)
 	{
 		mScheme.clear();
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 9da7717b74c..319d220b510 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1352,11 +1352,11 @@ bool idle_startup()
 			{
 				LLStringUtil::format_map_t args;
 				args["[NUMBER]"] = llformat("%d", num_retries + 1);
-				set_startup_status(0.4f, LLTrans::getString("LoginRetrySeedCapGrant", args), gAgent.mMOTD);
+				set_startup_status(0.4f, LLTrans::getString("LoginRetrySeedCapGrant", args), gAgent.mMOTD.c_str());
 			}
 			else
 			{
-				set_startup_status(0.4f, LLTrans::getString("LoginRequestSeedCapGrant"), gAgent.mMOTD);
+				set_startup_status(0.4f, LLTrans::getString("LoginRequestSeedCapGrant"), gAgent.mMOTD.c_str());
 			}
 		}
 		display_startup();
@@ -2070,7 +2070,7 @@ bool idle_startup()
 			update_texture_fetch();
 			set_startup_status(0.60f + 0.30f * timeout_frac,
 				LLTrans::getString("LoginPrecaching"),
-					gAgent.mMOTD);
+					gAgent.mMOTD.c_str());
 			display_startup();
 		}
 		
-- 
GitLab