* Patch attached that adds the check for uninitialized appearance when inventory items are received and processed. Also attempts to ensure that appearance is initialized even 
when the profile cache has not been built.
* This will not fix the race condition, but should at least remove the unhandled exception that is being reported in Mantis 0002126.
* Thanks cmickeyb
0.6.0-stable
Justin Clarke Casey 2008-09-12 21:32:45 +00:00
parent 1edee634ca
commit 9cdd9e215c
2 changed files with 26 additions and 13 deletions

View File

@ -2382,24 +2382,23 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="appearance"></param>
public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
{
appearance = null; // VS needs this line, mono doesn't
appearance = new AvatarAppearance();
try
{
if (m_AvatarFactory == null ||
!m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
if (m_AvatarFactory != null)
{
m_log.Warn("[APPEARANCE]: Appearance not found, creating default");
appearance = new AvatarAppearance();
if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
return;
}
}
catch (Exception e)
{
m_log.ErrorFormat(
"[APPERANCE]: Problem when fetching appearance for avatar {0}, {1}, using default. {2}",
client.Name, client.AgentId, e);
appearance = new AvatarAppearance();
m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}, {2}",
client.Name, client.AgentId, e.ToString());
}
m_log.Warn("[APPEARANCE]: Appearance not found, returning default");
}
/// <summary>

View File

@ -2911,19 +2911,33 @@ namespace OpenSim.Region.Environment.Scenes
private void ItemReceived(UUID itemID)
{
if (null == m_appearance)
{
m_log.Warn("[ATTACHMENT] Appearance has not been initialized");
return;
}
int attachpoint = m_appearance.GetAttachpoint(itemID);
if (attachpoint == 0)
return;
UUID asset = m_appearance.GetAttachedAsset(attachpoint);
if (asset == UUID.Zero) // We have just logged in
if (UUID.Zero == asset) // We have just logged in
{
m_log.InfoFormat("[ATTACHMENT] Rez attachment {0}",
itemID.ToString());
// Rez from inventory
m_scene.RezSingleAttachment(ControllingClient, itemID,
(uint)attachpoint, 0, 0);
try
{
// Rez from inventory
m_scene.RezSingleAttachment(ControllingClient, itemID,
(uint)attachpoint, 0, 0);
}
catch (Exception e)
{
m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString());
}
return;
}