aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs32
1 files changed, 28 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index cc37225..92fb934 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1279,9 +1279,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1279 string xml = instance.GetXMLState(); 1279 string xml = instance.GetXMLState();
1280 1280
1281 XmlDocument sdoc = new XmlDocument(); 1281 XmlDocument sdoc = new XmlDocument();
1282 sdoc.LoadXml(xml); 1282 bool loadedState = true;
1283 XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); 1283 try
1284 XmlNode rootNode = rootL[0]; 1284 {
1285 sdoc.LoadXml(xml);
1286 }
1287 catch (System.Xml.XmlException e)
1288 {
1289 loadedState = false;
1290 }
1291
1292 XmlNodeList rootL = null;
1293 XmlNode rootNode = null;
1294 if (loadedState)
1295 {
1296 rootL = sdoc.GetElementsByTagName("ScriptState");
1297 rootNode = rootL[0];
1298 }
1285 1299
1286 // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> 1300 // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
1287 XmlDocument doc = new XmlDocument(); 1301 XmlDocument doc = new XmlDocument();
@@ -1297,8 +1311,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1297 stateData.Attributes.Append(engineName); 1311 stateData.Attributes.Append(engineName);
1298 doc.AppendChild(stateData); 1312 doc.AppendChild(stateData);
1299 1313
1314 XmlNode xmlstate = null;
1315
1300 // Add <ScriptState>...</ScriptState> 1316 // Add <ScriptState>...</ScriptState>
1301 XmlNode xmlstate = doc.ImportNode(rootNode, true); 1317 if (loadedState)
1318 {
1319 xmlstate = doc.ImportNode(rootNode, true);
1320 }
1321 else
1322 {
1323 xmlstate = doc.CreateElement("", "ScriptState", "");
1324 }
1325
1302 stateData.AppendChild(xmlstate); 1326 stateData.AppendChild(xmlstate);
1303 1327
1304 string assemName = instance.GetAssemblyName(); 1328 string assemName = instance.GetAssemblyName();