diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index deaa3e138e86b1b2b759b3693e6db99153976326..a8f53a38c39c74138818f8056377cbccaaef5afe 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -575,7 +575,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name)
 	LLStringUtil::toUpper(cap_letter);
 	legacy_name = cap_letter + legacy_name.substr(1);
 
-	if (name_results[4].matched)
+	if (name_results[3].matched)
 	{
 		std::string last_name = name_results[3];
 		std::string cap_letter = last_name.substr(1, 1);