2006-09-08 Robert Jordan <robertj@gmx.net>
authorRobert Jordan <robertj@gmx.net>
Fri, 8 Sep 2006 21:09:10 +0000 (21:09 -0000)
committerRobert Jordan <robertj@gmx.net>
Fri, 8 Sep 2006 21:09:10 +0000 (21:09 -0000)
* TraceData.cs: fixed NRE if `sizes' is null, which may happen
if a page was unable to save its viewstate and size.

svn path=/trunk/mcs/; revision=65134

mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/TraceData.cs

index 84b8a832dcbcf2407b26480bfe399866ccdd71b3..a311b6d19fe50f3ac91982707fc5722543a43419 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-08  Robert Jordan  <robertj@gmx.net>
+
+       * TraceData.cs: fixed NRE if `sizes' is null, which may happen
+       if a page was unable to save its viewstate and size.
+
 2006-09-07 Andrew Skiba <andrews@mainsoft.com>
 
        * HttpApplicationFactory.cs: ifdef the previous fix with TARGET_JVM to
index 3abe5080ca09b647e59a555fa42b3e1ec6473d21..7b97e7d9e02c4014845ea702f6c768054223f75a 100644 (file)
@@ -179,8 +179,7 @@ namespace System.Web {
                        r ["ControlId"] = c.UniqueID;
                        r ["Type"] = c.GetType ();
                        r ["Depth"] = control_pos;
-                       object s = sizes [c];
-                       r ["RenderSize"] = (s == null) ? 0 : (int) s;
+                       r ["RenderSize"] = GetRenderSize (c);
                        r ["ViewstateSize"] = GetViewStateSize (c, (ctrl_vs != null) ? ctrl_vs [c] : null);
 
                        control_data.Rows.Add (r);
@@ -191,6 +190,15 @@ namespace System.Web {
                        }
                }
 
+               int GetRenderSize (Control ctrl)
+               {
+                       if (sizes == null)
+                               return 0;
+
+                       object s = sizes [ctrl];
+                       return s == null ? 0 : (int) s;
+               }
+
                static int GetViewStateSize (Control ctrl, object vs)
                {
                        if (vs == null)