diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index bc93fa2c20f0e5592727b1b72eb25570892b6107..deef3dbce76eccf273c99f049ed9135b6fb324a1 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -113,6 +113,11 @@ void LLLoginInstance::connect(LLPointer<LLCredential> credentials)
 {
 	std::vector<std::string> uris;
 	LLGridManager::getInstance()->getLoginURIs(uris);
+    if (uris.size() < 1)
+    {
+        LL_WARNS() << "Failed to get login URIs during connect. No connect for you!" << LL_ENDL;
+        return;
+    }
 	connect(uris.front(), credentials);
 }
 
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index 6937d064f982bfa5ce88a0e5b7ed5dd6bd639c8d..0072baa02c464d1736486010d821826f83d3cdd0 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -484,12 +484,19 @@ void LLGridManager::getLoginURIs(const std::string& grid, std::vector<std::strin
 	std::string grid_name = getGrid(grid);
 	if (!grid_name.empty())
 	{
-		for (LLSD::array_iterator llsd_uri = mGridList[grid_name][GRID_LOGIN_URI_VALUE].beginArray();
-			 llsd_uri != mGridList[grid_name][GRID_LOGIN_URI_VALUE].endArray();
-			 llsd_uri++)
-		{
-			uris.push_back(llsd_uri->asString());
-		}
+        if (mGridList[grid_name][GRID_LOGIN_URI_VALUE].isArray())
+        {
+		    for (LLSD::array_iterator llsd_uri = mGridList[grid_name][GRID_LOGIN_URI_VALUE].beginArray();
+			     llsd_uri != mGridList[grid_name][GRID_LOGIN_URI_VALUE].endArray();
+			     llsd_uri++)
+		    {
+			    uris.push_back(llsd_uri->asString());
+		    }
+        }
+        else
+        {
+            uris.push_back(mGridList[grid_name][GRID_LOGIN_URI_VALUE].asString());
+        }
 	}
 	else
 	{