Skip to content

Commit

Permalink
Merge pull request #255 from batzen/patch-1
Browse files Browse the repository at this point in the history
Prevent null reference exception when rendering
  • Loading branch information
siegfriedpammer committed Mar 8, 2021
2 parents 15e564f + a046e2d commit a8d86c1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ICSharpCode.AvalonEdit/Folding/FoldingMarginMarker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ protected override Size MeasureCore(Size availableSize)
protected override void OnRender(DrawingContext drawingContext)
{
FoldingMargin margin = VisualParent as FoldingMargin;
if (margin == null) {
return;
}
Pen activePen = new Pen(margin.SelectedFoldingMarkerBrush, 1);
Pen inactivePen = new Pen(margin.FoldingMarkerBrush, 1);
activePen.StartLineCap = inactivePen.StartLineCap = PenLineCap.Square;
Expand Down

0 comments on commit a8d86c1

Please sign in to comment.