Skip to content

Commit

Permalink
Fix #857: NullReferenceException in LinesRenderer.OnRender()
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrunwald committed Dec 2, 2017
1 parent 75a3f6d commit 930ed37
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SharpTreeView/LinesRenderer.cs
Expand Up @@ -3,6 +3,7 @@

using System.Windows;
using System.Windows.Media;
using System.Diagnostics;

namespace ICSharpCode.TreeView
{
Expand All @@ -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);

Expand Down

0 comments on commit 930ed37

Please sign in to comment.