diff options
author | UbitUmarov | 2017-06-08 20:47:51 +0100 |
---|---|---|
committer | UbitUmarov | 2017-06-08 20:47:51 +0100 |
commit | ef2fd8fcea311c32582a2fba7d8979c529ff05be (patch) | |
tree | 865ae9b89c79b3c2570b5d6f3f1922912c33b68e /OpenSim/Framework | |
parent | revert fa5bf4fd0bb6a855eacdb7b5eec9cd71ad9bf606 for test (diff) | |
download | opensim-SC_OLD-ef2fd8fcea311c32582a2fba7d8979c529ff05be.zip opensim-SC_OLD-ef2fd8fcea311c32582a2fba7d8979c529ff05be.tar.gz opensim-SC_OLD-ef2fd8fcea311c32582a2fba7d8979c529ff05be.tar.bz2 opensim-SC_OLD-ef2fd8fcea311c32582a2fba7d8979c529ff05be.tar.xz |
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
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index a830551..96d78d3 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -1580,35 +1580,48 @@ namespace OpenSim.Framework | |||
1580 | { | 1580 | { |
1581 | MediaList ml = new MediaList(); | 1581 | MediaList ml = new MediaList(); |
1582 | ml.ReadXml(rawXml); | 1582 | ml.ReadXml(rawXml); |
1583 | if(ml.Count == 0) | ||
1584 | return null; | ||
1583 | return ml; | 1585 | return ml; |
1584 | } | 1586 | } |
1585 | 1587 | ||
1586 | public void ReadXml(string rawXml) | 1588 | public void ReadXml(string rawXml) |
1587 | { | 1589 | { |
1588 | using (StringReader sr = new StringReader(rawXml)) | 1590 | try |
1589 | { | 1591 | { |
1590 | using (XmlTextReader xtr = new XmlTextReader(sr)) | 1592 | using (StringReader sr = new StringReader(rawXml)) |
1591 | { | 1593 | { |
1592 | xtr.MoveToContent(); | 1594 | using (XmlTextReader xtr = new XmlTextReader(sr)) |
1595 | { | ||
1596 | xtr.MoveToContent(); | ||
1593 | 1597 | ||
1594 | string type = xtr.GetAttribute("type"); | 1598 | string type = xtr.GetAttribute("type"); |
1595 | //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); | 1599 | //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); |
1596 | 1600 | ||
1597 | if (type != MEDIA_TEXTURE_TYPE) | 1601 | if (type != MEDIA_TEXTURE_TYPE) |
1598 | return; | 1602 | return; |
1599 | 1603 | ||
1600 | xtr.ReadStartElement("OSMedia"); | 1604 | xtr.ReadStartElement("OSMedia"); |
1605 | OSD osdp = OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); | ||
1606 | if(osdp == null || !(osdp is OSDArray)) | ||
1607 | return; | ||
1601 | 1608 | ||
1602 | OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); | 1609 | OSDArray osdMeArray = osdp as OSDArray; |
1603 | foreach (OSD osdMe in osdMeArray) | 1610 | if(osdMeArray.Count == 0) |
1604 | { | 1611 | return; |
1605 | MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); | ||
1606 | Add(me); | ||
1607 | } | ||
1608 | 1612 | ||
1609 | xtr.ReadEndElement(); | 1613 | foreach (OSD osdMe in osdMeArray) |
1614 | { | ||
1615 | MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); | ||
1616 | Add(me); | ||
1617 | } | ||
1618 | } | ||
1610 | } | 1619 | } |
1611 | } | 1620 | } |
1621 | catch | ||
1622 | { | ||
1623 | m_log.Debug("PrimitiveBaseShape] error decoding MOAP xml" ); | ||
1624 | } | ||
1612 | } | 1625 | } |
1613 | 1626 | ||
1614 | public void ReadXml(XmlReader reader) | 1627 | public void ReadXml(XmlReader reader) |