MediaGalleryBrowseableList.GetPathToNode

rated by 0 users
This post has 3 Replies | 2 Followers

Top 75 Contributor
Posts 309
Points 3,630
deerchao Posted: Tue, May 13 2008 7:07 AM

The original code

            if (g != null)
                path.Add(ApplicationBrowseableList.MakeID(g.GroupID, -1, -1, -1, ""));

            if (mg != null)
                path.Add(ApplicationBrowseableList.MakeID(g.GroupID, mg.SectionID, -1, -1, ""));

            if (pc != null)
                path.Add(ApplicationBrowseableList.MakeID(g.GroupID, mg.SectionID, pc.CategoryID, -1, ""));

            if (p != null)
                path.Add(ApplicationBrowseableList.MakeID(g.GroupID, mg.SectionID, -1, p.PostID, parentCategoryIds));

should be like this:

            int gId = -1;
            if (g != null)
            {
                path.Add(ApplicationBrowseableList.MakeID(g.GroupID, -1, -1, -1, ""));
                gId = g.GroupID;
            }

            int mgId = -1;
            if (mg != null)
            {
                path.Add(ApplicationBrowseableList.MakeID(gId, mg.SectionID, -1, -1, ""));
                mgId = mg.SectionID;
            }

            if (pc != null)
                path.Add(ApplicationBrowseableList.MakeID(gId, mgId, pc.CategoryID, -1, ""));

            if (p != null)
                path.Add(ApplicationBrowseableList.MakeID(gId, mgId, -1, p.PostID, parentCategoryIds));

otherwise there might be a NullReferenceException.

  • | Post Points: 20
Top 10 Contributor
Posts 3,424
Points 65,735
CS Developers
Ben Tiedt replied on Tue, May 13 2008 8:03 AM

Have you received a null reference exception?

If the key of the node whose path is retrieved is a valid key, a null reference should not occur -- all of the key prefix cases populate the g variable.

Ben Tiedt's Blog

  • | Post Points: 20
Top 75 Contributor
Posts 309
Points 3,630
deerchao replied on Tue, May 13 2008 9:36 AM

Yes, I've got one when I'm browsing the content selector in my local test instance.

 

  • | Post Points: 20
Top 10 Contributor
Posts 3,424
Points 65,735
CS Developers
Ben Tiedt replied on Wed, May 21 2008 12:44 PM

Thanks.  I've logged this issue as #935.  Updates to the issue will be posted to this thread.

Ben Tiedt's Blog

  • | Post Points: 5
Page 1 of 1 (4 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com