]> O.S.I.I.S - jp/crow.git/commitdiff
Avoid some null exception while layouting when parent not already set, and raise...
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 21 Aug 2015 14:13:30 +0000 (16:13 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 21 Aug 2015 14:13:30 +0000 (16:13 +0200)
src/GraphicObjects/GraphicObject.cs
src/Interface.cs

index 4e13b34d9629dfb9e5a47226b9bbccc7b0fd7289..457a60164cd74cf9d0dbb2811dbb0bc97dd842b5 100644 (file)
@@ -379,7 +379,8 @@ namespace go
                /// </summary>\r
                public virtual void RegisterForRedraw ()\r
                {\r
-                       TopContainer.gobjsToRedraw.Add (this);\r
+                       if (TopContainer != null)\r
+                               TopContainer.gobjsToRedraw.Add (this);\r
                }\r
 \r
                /// <summary>\r
@@ -457,6 +458,9 @@ namespace go
                /// <summary> trigger dependant sizing component update </summary>\r
                protected virtual void OnLayoutChanges(LayoutingType  layoutType)\r
                {\r
+                       if (Parent==null)\r
+                               return;\r
+                       \r
                        switch (layoutType) {\r
                        case LayoutingType.Width:                               \r
                                if (Parent.getBounds ().Width < 0)\r
index 2fe25c6099079687208ef60b9d18d3b90c7701fa..3e0f8771aef68070042c50858f2e0f3c408eac39 100644 (file)
@@ -89,6 +89,9 @@ namespace go
                        string root = "Object";
 
                        Stream stream = GetStreamFromPath (path);
+                       if (stream == null)
+                               throw new FileNotFoundException ("GOML file not found", path);
+                       
                        using (XmlReader reader = XmlReader.Create (stream)) {
                                while (reader.Read()) {
                                        // first element is the root element