aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 61a2088..4715690 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1274,9 +1274,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1274 string xml = instance.GetXMLState(); 1274 string xml = instance.GetXMLState();
1275 1275
1276 XmlDocument sdoc = new XmlDocument(); 1276 XmlDocument sdoc = new XmlDocument();
1277 sdoc.LoadXml(xml); 1277 bool loadedState = true;
1278 XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); 1278 try
1279 XmlNode rootNode = rootL[0]; 1279 {
1280 sdoc.LoadXml(xml);
1281 }
1282 catch (System.Xml.XmlException e)
1283 {
1284 loadedState = false;
1285 }
1286
1287 XmlNodeList rootL = null;
1288 XmlNode rootNode = null;
1289 if (loadedState)
1290 {
1291 rootL = sdoc.GetElementsByTagName("ScriptState");
1292 rootNode = rootL[0];
1293 }
1280 1294
1281 // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> 1295 // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
1282 XmlDocument doc = new XmlDocument(); 1296 XmlDocument doc = new XmlDocument();
@@ -1292,8 +1306,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1292 stateData.Attributes.Append(engineName); 1306 stateData.Attributes.Append(engineName);
1293 doc.AppendChild(stateData); 1307 doc.AppendChild(stateData);
1294 1308
1309 XmlNode xmlstate = null;
1310
1295 // Add <ScriptState>...</ScriptState> 1311 // Add <ScriptState>...</ScriptState>
1296 XmlNode xmlstate = doc.ImportNode(rootNode, true); 1312 if (loadedState)
1313 {
1314 xmlstate = doc.ImportNode(rootNode, true);
1315 }
1316 else
1317 {
1318 xmlstate = doc.CreateElement("", "ScriptState", "");
1319 }
1320
1297 stateData.AppendChild(xmlstate); 1321 stateData.AppendChild(xmlstate);
1298 1322
1299 string assemName = instance.GetAssemblyName(); 1323 string assemName = instance.GetAssemblyName();