diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index ca7ec7cc30a7ce8727ceb25ec4e3400b97aac762..cbbdcb2983fc6d47b767b23d817f49b5fb2d9ec3 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -302,8 +302,14 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids)
 
 static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name)
 {
-	llinfos << "opening web profile for " << av_name.mUsername << llendl;		
-	std::string url = getProfileURL(av_name.mUsername);
+	std::string username = av_name.mUsername;
+	if (username.empty())
+	{
+		username = LLCacheName::buildUsername(av_name.mDisplayName);
+	}
+	
+	llinfos << "opening web profile for " << username << llendl;		
+	std::string url = getProfileURL(username);
 
 	// PROFILES: open in webkit window
 	LLWeb::loadWebURLInternal(url, "", agent_id.asString());