Permalink
Browse files

Fix #857: NullReferenceException in LinesRenderer.OnRender()

  • Loading branch information...
dgrunwald committed Dec 2, 2017
1 parent 75a3f6d commit 930ed379730efadff51e3302ea5739fb143332f3
Showing with 7 additions and 0 deletions.
  1. +7 −0 SharpTreeView/LinesRenderer.cs
@@ -3,6 +3,7 @@
using System.Windows;
using System.Windows.Media;
using System.Diagnostics;
namespace ICSharpCode.TreeView
{
@@ -23,6 +24,12 @@ SharpTreeNodeView NodeView
protected override void OnRender(DrawingContext dc)
{
if (NodeView.Node == null) {
// This seems to happen sometimes with DataContext==DisconnectedItem,
// though I'm not sure why WPF would call OnRender() on a disconnected node
Debug.WriteLine($"LinesRenderer.OnRender() called with DataContext={NodeView.DataContext}");
return;
}
var indent = NodeView.CalculateIndent();
var p = new Point(indent + 4.5, 0);

0 comments on commit 930ed37

Please sign in to comment.