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.
May god let you know what English I'm speaking...:D
CS08 Simplified Chinese Language Resources Download
CS08简体中文语言资源下载
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.
Yes, I've got one when I'm browsing the content selector in my local test instance.
Thanks. I've logged this issue as #935. Updates to the issue will be posted to this thread.
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com