Fix the XML serializationt to provide an empty script state element if
the script hasn't yet saved state, or can't save state because of a loopprebuild-update
parent
5d11833ae1
commit
6701fc2ffa
|
@ -1274,9 +1274,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
string xml = instance.GetXMLState();
|
string xml = instance.GetXMLState();
|
||||||
|
|
||||||
XmlDocument sdoc = new XmlDocument();
|
XmlDocument sdoc = new XmlDocument();
|
||||||
|
bool loadedState = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
sdoc.LoadXml(xml);
|
sdoc.LoadXml(xml);
|
||||||
XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
|
}
|
||||||
XmlNode rootNode = rootL[0];
|
catch (System.Xml.XmlException e)
|
||||||
|
{
|
||||||
|
loadedState = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlNodeList rootL = null;
|
||||||
|
XmlNode rootNode = null;
|
||||||
|
if (loadedState)
|
||||||
|
{
|
||||||
|
rootL = sdoc.GetElementsByTagName("ScriptState");
|
||||||
|
rootNode = rootL[0];
|
||||||
|
}
|
||||||
|
|
||||||
// Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
|
// Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
|
@ -1292,8 +1306,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
stateData.Attributes.Append(engineName);
|
stateData.Attributes.Append(engineName);
|
||||||
doc.AppendChild(stateData);
|
doc.AppendChild(stateData);
|
||||||
|
|
||||||
|
XmlNode xmlstate = null;
|
||||||
|
|
||||||
// Add <ScriptState>...</ScriptState>
|
// Add <ScriptState>...</ScriptState>
|
||||||
XmlNode xmlstate = doc.ImportNode(rootNode, true);
|
if (loadedState)
|
||||||
|
{
|
||||||
|
xmlstate = doc.ImportNode(rootNode, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xmlstate = doc.CreateElement("", "ScriptState", "");
|
||||||
|
}
|
||||||
|
|
||||||
stateData.AppendChild(xmlstate);
|
stateData.AppendChild(xmlstate);
|
||||||
|
|
||||||
string assemName = instance.GetAssemblyName();
|
string assemName = instance.GetAssemblyName();
|
||||||
|
|
Loading…
Reference in New Issue