From 170d61d2003b28b6d9a06171e3b33e8cd16aa85e Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Wed, 4 Apr 2007 22:29:45 +0000
Subject: [PATCH] svn merge svn+ssh://svn/svn/linden/branches/maintenance -r
 59998:59999 into release Fix for groups showing up as 'nobody'

---
 indra/newview/llnamelistctrl.cpp | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index eabb9e0b23e..d8c29874700 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -175,13 +175,21 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos
 	char first[DB_FIRST_NAME_BUF_SIZE];		/*Flawfinder: ignore*/
 	char last[DB_LAST_NAME_BUF_SIZE];		/*Flawfinder: ignore*/
 
-	gCacheName->getName(item->getUUID(), first, last);
-
 	LLString fullname;
-	fullname.assign(first);
-	fullname.append(1, ' ');
-	fullname.append(last);
-
+	if (gCacheName->getName(item->getUUID(), first, last))
+	{
+		fullname.assign(first);
+		fullname.append(1, ' ');
+		fullname.append(last);
+	}
+	else // didn't work as a resident name, try looking up as a group
+	{
+		char group_name[DB_GROUP_NAME_BUF_SIZE];		/*Flawfinder: ignore*/
+		gCacheName->getGroupName(item->getUUID(), group_name);
+		// fullname will be "nobody" if group not found
+		fullname = group_name;
+	}
+	
 	LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex);
 	((LLScrollListText*)cell)->setText( fullname );
 
-- 
GitLab