beagle r4754 - trunk/beagle/Util



Author: dbera
Date: Tue May 13 23:57:30 2008
New Revision: 4754
URL: http://svn.gnome.org/viewvc/beagle?rev=4754&view=rev

Log:
Catch exceptions due to corrupt config files. Fixes #532308.


Modified:
   trunk/beagle/Util/Config.cs

Modified: trunk/beagle/Util/Config.cs
==============================================================================
--- trunk/beagle/Util/Config.cs	(original)
+++ trunk/beagle/Util/Config.cs	Tue May 13 23:57:30 2008
@@ -339,8 +339,13 @@
 
 			Config config = null;
 
-			using (StreamReader reader = new StreamReader (path))
-				config = (Config) conf_ser.Deserialize (reader);
+			try {
+				using (StreamReader reader = new StreamReader (path))
+					config = (Config) conf_ser.Deserialize (reader);
+			} catch (XmlException e) {
+				Log.Error (e, "Unable to parse {0}, possibly corrupt file.", path);
+				return null;
+			}
 
 			return config;
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]