[Mono-dev] PATCH: System.Web/SiteMapNode.cs - fix NullRef exceptions
Chris Toshok
toshok at ximian.com
Tue Apr 11 08:09:22 EDT 2006
also please add a testcase for this.
Chris
On Tue, 2006-04-11 at 03:23 -0700, Andrew Skiba wrote:
> This patch still does not handle situation when attributes==null and
> node.attributes!=null. Please review the corrected patch. If no one
> objects, I will commit.
>
> Index: SiteMapNode.cs
> ===================================================================
> --- SiteMapNode.cs (revision 59261)
> +++ SiteMapNode.cs (working copy)
> @@ -238,7 +238,8 @@
> node.title = title;
> node.description = description;
> node.roles = new ArrayList (roles);
> - node.attributes = new NameValueCollection
> (attributes);
> + if (attributes != null)
> + node.attributes = new
> NameValueCollection (attributes);
> if (cloneParentNodes && ParentNode != null)
> node.parent = (SiteMapNode)
> ParentNode.Clone (true);
> return node;
> @@ -262,7 +263,9 @@
> foreach (object role in roles)
> if (!node.roles.Contains (role)) return
> false;
>
> - if ((attributes == null || node.attributes ==
> null) && (attributes != node.attributes)) return false;
> + if (attributes == null || node.attributes ==
> null)
> + return (attributes == null &&
> node.attributes == null);
> +
> if (attributes.Count != node.attributes.Count)
> return false;
>
> foreach (string k in attributes)
>
> > -----Original Message-----
> > From: mono-devel-list-bounces at lists.ximian.com
> > [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf
> > Of Konstantin Triger
> > Sent: Tuesday, April 11, 2006 11:30
> > To: mono-devel
> > Subject: [Mono-dev] PATCH: System.Web/SiteMapNode.cs - fix
> > NullRef exceptions
> >
> > Hello,
> >
> >
> >
> > Attached a patch fixing NullRefs exceptions.
> >
> > If no one objects I'll commit.
> >
> >
> >
> > Regards,
> >
> > Konstantin Triger
> >
> >
> >
> >
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list