From bcb27d44062c478508f1cd5d211d204b2f151e8a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 15 Nov 2015 08:16:52 +0000 Subject: [PATCH] fix the protection for more Wearables than region suports --- OpenSim/Framework/AvatarAppearance.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index f442fc2945..e1725a9c72 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -458,11 +458,11 @@ namespace OpenSim.Framework // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // DEBUG OFF m_wearables[wearableId].Clear(); - int count = wearable.Count; - if (count > AvatarWearable.MAX_WEARABLES) - count = AvatarWearable.MAX_WEARABLES; - for (int i = 0; i < count; i++) - m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); + int count = wearable.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + for (int i = 0; i < count; i++) + m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); } // DEBUG ON @@ -760,7 +760,10 @@ namespace OpenSim.Framework if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(data["wearables"]); - for (int i = 0; i < wears.Count; i++) + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + for (int i = 0; i < count; i++) m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); } else