From d3bec765b8c185f28bbe9acb515a799ef5d150a0 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 17 Jun 2022 15:44:42 +1000 Subject: Fix crash printing on Win32 in bidirectional mode with a non-empty selection. --- src/EditView.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/EditView.cxx b/src/EditView.cxx index c24adeb12..5a793f16c 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1980,12 +1980,14 @@ static void DrawTranslucentSelection(Surface *surface, const EditModel &model, c const ScreenLine screenLine(ll, subLine, vsDraw, rcLine.right, tabWidthMinimumPixels); std::unique_ptr slLayout = surface->Layout(&screenLine); - const std::vector intervals = slLayout->FindRangeIntervals(selectionStart, selectionEnd); - for (const Interval &interval : intervals) { - const XYPOSITION rcRight = interval.right + xStart; - const XYPOSITION rcLeft = interval.left + xStart; - const PRectangle rcSelection(rcLeft, rcLine.top, rcRight, rcLine.bottom); - surface->FillRectangleAligned(rcSelection, selectionBack); + if (slLayout) { + const std::vector intervals = slLayout->FindRangeIntervals(selectionStart, selectionEnd); + for (const Interval &interval : intervals) { + const XYPOSITION rcRight = interval.right + xStart; + const XYPOSITION rcLeft = interval.left + xStart; + const PRectangle rcSelection(rcLeft, rcLine.top, rcRight, rcLine.bottom); + surface->FillRectangleAligned(rcSelection, selectionBack); + } } if (portion.end.VirtualSpace()) { -- cgit v1.2.3