Prevent an "index out of range" error on login

avinationmerge
Melanie Thielker 2010-05-18 03:02:36 +02:00
parent c25c40a3f9
commit eb5a95d26b
1 changed files with 5 additions and 2 deletions

View File

@ -454,9 +454,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private void StatusNotifyMass(List<FriendInfo> friendList, UUID userID, bool online)
{
string[] friendIDs = new string[friendList.Count];
int fct = friendList.Count;
string[] friendIDs = new string[fct];
int notlocal = 0;
for (int x = 0; x < friendList.Count; x++)
for (int x = 0 ; x < fct ; x++)
{
UUID friendID = UUID.Zero;
if (UUID.TryParse(friendList[x].Friend, out friendID))
@ -472,6 +473,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
for (int x = 0; x < friendSessions.GetLength(0); x++)
{
if (friendIDs.Length <= x)
continue;
PresenceInfo friendSession = friendSessions[x];
if (friendSession != null)
{