Browse Source

Fixed potential NullReferenceException in HeightTree.GetNodeByVisualPosition

pull/21/merge
Daniel Grunwald 14 years ago
parent
commit
b3ed4c86a8
  1. 3
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/HeightTree.cs

3
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/HeightTree.cs

@ -446,7 +446,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
// i.e. at the end of the document, or due to rounding errors in previous loop iterations. // i.e. at the end of the document, or due to rounding errors in previous loop iterations.
// If node.lineNode isn't collapsed, return that. // If node.lineNode isn't collapsed, return that.
if (node.lineNode.TotalHeight > 0) // Also return node.lineNode if there is no previous node that we could return instead.
if (node.lineNode.TotalHeight > 0 || node.left == null)
return node; return node;
// Otherwise, descend into left (find the last non-collapsed node) // Otherwise, descend into left (find the last non-collapsed node)
node = node.left; node = node.left;

Loading…
Cancel
Save