keep the reverted code, that does work. Our code likes to have pbs.Media == null when there is no MOAD defined, so handle possible odd oars that may have llsd <array /> on that case

0.9.0-post-fixes
UbitUmarov 2017-06-08 20:47:51 +01:00
parent 29f2421d4f
commit ef2fd8fcea
1 changed files with 31 additions and 18 deletions

View File

@ -1580,35 +1580,48 @@ namespace OpenSim.Framework
{
MediaList ml = new MediaList();
ml.ReadXml(rawXml);
if(ml.Count == 0)
return null;
return ml;
}
public void ReadXml(string rawXml)
{
using (StringReader sr = new StringReader(rawXml))
try
{
using (XmlTextReader xtr = new XmlTextReader(sr))
using (StringReader sr = new StringReader(rawXml))
{
xtr.MoveToContent();
string type = xtr.GetAttribute("type");
//m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type);
if (type != MEDIA_TEXTURE_TYPE)
return;
xtr.ReadStartElement("OSMedia");
OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
foreach (OSD osdMe in osdMeArray)
using (XmlTextReader xtr = new XmlTextReader(sr))
{
MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
Add(me);
}
xtr.MoveToContent();
xtr.ReadEndElement();
string type = xtr.GetAttribute("type");
//m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type);
if (type != MEDIA_TEXTURE_TYPE)
return;
xtr.ReadStartElement("OSMedia");
OSD osdp = OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
if(osdp == null || !(osdp is OSDArray))
return;
OSDArray osdMeArray = osdp as OSDArray;
if(osdMeArray.Count == 0)
return;
foreach (OSD osdMe in osdMeArray)
{
MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
Add(me);
}
}
}
}
catch
{
m_log.Debug("PrimitiveBaseShape] error decoding MOAP xml" );
}
}
public void ReadXml(XmlReader reader)