From 946db5461c8262d3b957e42ed7a90feb447c618b Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sat, 17 Nov 2007 05:53:12 +0000 Subject: catch exceptions when loading malformed xml files --- OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs') diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index 765c42e..05caa84 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs @@ -27,8 +27,10 @@ */ using System.IO; +using System.Xml; using libsecondlife; using Nini.Config; +using OpenSim.Framework.Console; namespace OpenSim.Framework.Communications.Cache { @@ -65,8 +67,15 @@ namespace OpenSim.Framework.Communications.Cache string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); if (File.Exists(filePath)) { - XmlConfigSource source = new XmlConfigSource(filePath); - ReadItemsFromFile(source); + try + { + XmlConfigSource source = new XmlConfigSource(filePath); + ReadItemsFromFile(source); + } + catch (XmlException e) + { + MainLog.Instance.Error("INVENTORY", "Error loading " + filePath + ": " + e.ToString()); + } } } -- cgit v1.1