From ff36a1bc7bcd1d0fe5aecb4c5358dbb072c7ff6e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 14 Nov 2011 16:06:06 +0000 Subject: If a friends identifier which is too short is given to HGFriendsModule.GetOnlineFriends() then spit out a warning rather than failing on the String.Substring(). This is to progress http://opensimulator.org/mantis/view.php?id=5789 --- OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index dda67f9..02b417f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -141,7 +141,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { List fList = new List(); foreach (string s in friendList) - fList.Add(s.Substring(0, 36)); + { + if (s.Length < 36) + m_log.WarnFormat( + "[HGFRIENDS MODULE]: Ignoring friend {0} ({1} chars) for {2} since identifier too short", + s, s.Length, userID); + else + fList.Add(s.Substring(0, 36)); + } PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray()); foreach (PresenceInfo pi in presence) -- cgit v1.1