cloudscribe/cloudscribe.Web.Navigation

Throws error if it can't find current node

Closed this issue · 3 comments

If it can't find the current node when calling GetClass, it throws a NullReferenceException error. Can this just swallow this error and move past, or have an option to ignore when a node can't be found?

NullReferenceException: Object reference not set to an instance of an object.
cloudscribe.Web.Navigation.TreeNodeExtensions+<>c__DisplayClass0_0.<FindByUrl>b__0(TreeNode<NavigationNode> n)
cloudscribe.Web.Navigation.TreeNode.Find(Func<TreeNode, bool> predicate)
cloudscribe.Web.Navigation.TreeNode.Find(Func<TreeNode, bool> predicate)
cloudscribe.Web.Navigation.NavigationViewModel.get_CurrentNode()
cloudscribe.Web.Navigation.NavigationViewModelExtensions.GetClass(NavigationViewModel model, NavigationNode node, string inputClass, string activeClass)

@johnwc can you try with the latest release version 1.2.1. That extension method does check for null, but it can also return null which you may need to handle in the view https://github.com/joeaudette/cloudscribe.Web.Navigation/blob/master/src/cloudscribe.Web.Navigation/NavigationViewModelExtensions.cs

If you still get the problem with the latest please provide steps to produce the error

Hmm, weird, I just installed it last week and for some reason it installed 1.1.0-rc20170503

yes there have been frequent releases lately. Are you still getting the error or can we close this issue?