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,10 +1580,14 @@ namespace OpenSim.Framework
{ {
MediaList ml = new MediaList(); MediaList ml = new MediaList();
ml.ReadXml(rawXml); ml.ReadXml(rawXml);
if(ml.Count == 0)
return null;
return ml; return ml;
} }
public void ReadXml(string rawXml) public void ReadXml(string rawXml)
{
try
{ {
using (StringReader sr = new StringReader(rawXml)) using (StringReader sr = new StringReader(rawXml))
{ {
@ -1598,18 +1602,27 @@ namespace OpenSim.Framework
return; return;
xtr.ReadStartElement("OSMedia"); 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;
OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
foreach (OSD osdMe in osdMeArray) foreach (OSD osdMe in osdMeArray)
{ {
MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
Add(me); Add(me);
} }
xtr.ReadEndElement();
} }
} }
} }
catch
{
m_log.Debug("PrimitiveBaseShape] error decoding MOAP xml" );
}
}
public void ReadXml(XmlReader reader) public void ReadXml(XmlReader reader)
{ {