From 2f79009d32a84a25e3c246e42d06724677af2450 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Jan 2021 20:23:20 +0000 Subject: [PATCH] avoid a null ref on hg useragentservice --- .../HypergridService/UserAgentService.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 66e0ed4b71..bafd7773fe 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -644,19 +644,21 @@ namespace OpenSim.Services.HypergridService return targetUserID.ToString() + ";" + m_GridName + ";" + account.FirstName + " " + account.LastName ; // Let's try the list of friends - FriendInfo[] friends = m_FriendsService.GetFriends(userID); - if (friends != null && friends.Length > 0) + if(m_FriendsService != null) { - foreach (FriendInfo f in friends) - if (f.Friend.StartsWith(targetUserID.ToString())) - { - // Let's remove the secret - UUID id; string tmp = string.Empty, secret = string.Empty; - if (Util.ParseUniversalUserIdentifier(f.Friend, out id, out tmp, out tmp, out tmp, out secret)) - return f.Friend.Replace(secret, "0"); - } + FriendInfo[] friends = m_FriendsService.GetFriends(userID); + if (friends != null && friends.Length > 0) + { + foreach (FriendInfo f in friends) + if (f.Friend.StartsWith(targetUserID.ToString())) + { + // Let's remove the secret + UUID id; string tmp = string.Empty, secret = string.Empty; + if (Util.ParseUniversalUserIdentifier(f.Friend, out id, out tmp, out tmp, out tmp, out secret)) + return f.Friend.Replace(secret, "0"); + } + } } - return string.Empty; }