[Monodevelop-patches-list] r1437 - in trunk/MonoDevelop/src/Main/Base: . Gui/Workbench

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Apr 11 17:01:21 EDT 2004


Author: tberman
Date: 2004-04-11 17:01:21 -0400 (Sun, 11 Apr 2004)
New Revision: 1437

Modified:
   trunk/MonoDevelop/src/Main/Base/ChangeLog
   trunk/MonoDevelop/src/Main/Base/Gui/Workbench/WorkbenchMemento.cs
Log:
check for nullrefs


Modified: trunk/MonoDevelop/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/Main/Base/ChangeLog	2004-04-11 08:03:12 UTC (rev 1436)
+++ trunk/MonoDevelop/src/Main/Base/ChangeLog	2004-04-11 21:01:21 UTC (rev 1437)
@@ -1,5 +1,9 @@
 2004-04-11  Todd Berman  <tberman at sevenl.net>
 
+	* Gui/Workbench/WorkbenchMemento.cs: fix potential nullrefs.
+
+2004-04-11  Todd Berman  <tberman at sevenl.net>
+
 	* Commands/AutostartCommands.cs: reorganize the SetMemento so it works
 	better.
 	* Gui/Workbench/WorkbenchMemento.cs: readd windowstate.

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/WorkbenchMemento.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/WorkbenchMemento.cs	2004-04-11 08:03:12 UTC (rev 1436)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/WorkbenchMemento.cs	2004-04-11 21:01:21 UTC (rev 1437)
@@ -65,17 +65,20 @@
 		/// </summary>
 		public WorkbenchMemento()
 		{
-			//windowstate = FormWindowState.Maximized;
+			windowstate = 0;
 			bounds      = new Rectangle(0, 0, 640, 480);
 			fullscreen  = false;
 		}
 		
 		WorkbenchMemento(XmlElement element)
 		{
-			string[] boundstr = element.Attributes["bounds"].InnerText.Split(new char [] { ',' });
+			if (element.Attributes["bounds"] != null) {
+				string[] boundstr = element.Attributes["bounds"].InnerText.Split(new char [] { ',' });
+				
+				bounds = new Rectangle(Int32.Parse(boundstr[0]), Int32.Parse(boundstr[1]), 
+									   Int32.Parse(boundstr[2]), Int32.Parse(boundstr[3]));
+			}
 			
-			bounds = new Rectangle(Int32.Parse(boundstr[0]), Int32.Parse(boundstr[1]), 
-			                       Int32.Parse(boundstr[2]), Int32.Parse(boundstr[3]));
 			if (element.Attributes["formwindowstate"] != null) {
 				windowstate = (Gdk.WindowState)Enum.Parse(typeof(Gdk.WindowState), element.Attributes["formwindowstate"].InnerText);
 			}
@@ -83,8 +86,10 @@
 			/*if (element.Attributes["defaultformwindowstate"] != null) {
 				defaultwindowstate = (FormWindowState)Enum.Parse(typeof(FormWindowState), element.Attributes["defaultformwindowstate"].InnerText);
 			}*/
-			
-			fullscreen  = Boolean.Parse(element.Attributes["fullscreen"].InnerText);
+
+			if (element.Attributes["fullscreen"] != null) {
+				fullscreen  = Boolean.Parse(element.Attributes["fullscreen"].InnerText);
+			}
 		}
 
 		public object FromXmlElement(XmlElement element)




More information about the Monodevelop-patches-list mailing list