silly null ref

This commit is contained in:
UbitUmarov
2020-12-25 00:37:00 +00:00
parent d3e5b3d769
commit 7b5fc5c8bd

View File

@@ -269,38 +269,23 @@ namespace OpenSim.Services.HypergridService
bool SendIMToRegion(PresenceInfo upd, GridInstantMessage im, UUID toAgentID, bool foreigner)
{
bool imresult = false;
GridRegion reginfo = null;
if (!m_RegionCache.TryGetValue(upd.RegionID, REGIONCACHE_EXPIRATION, out reginfo))
if (!m_RegionCache.TryGetValue(upd.RegionID, REGIONCACHE_EXPIRATION, out reginfo) )
{
reginfo = m_GridService.GetRegionByUUID(UUID.Zero /*!!!*/, upd.RegionID);
m_RegionCache.AddOrUpdate(upd.RegionID, reginfo, reginfo == null ? 60000 : REGIONCACHE_EXPIRATION);
}
if (reginfo != null)
{
imresult = InstantMessageServiceConnector.SendInstantMessage(reginfo.ServerURI, im, m_messageKey);
}
else
{
m_log.DebugFormat("[HG IM SERVICE]: Failed to deliver message to {0}", reginfo.ServerURI);
if (reginfo == null)
return false;
}
bool imresult = InstantMessageServiceConnector.SendInstantMessage(reginfo.ServerURI, im, m_messageKey);
if (imresult)
{
// IM delivery successful, so store the Agent's location in our local cache.
lock (m_UserLocationMap)
{
if (m_UserLocationMap.ContainsKey(toAgentID))
{
m_UserLocationMap[toAgentID] = upd;
}
else
{
m_UserLocationMap.Add(toAgentID, upd);
}
}
m_UserLocationMap.Add(toAgentID, upd);
return true;
}
else