aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2022-06-17 15:44:42 +1000
committerNeil <nyamatongwe@gmail.com>2022-06-17 15:44:42 +1000
commitd3bec765b8c185f28bbe9acb515a799ef5d150a0 (patch)
tree601cac673011447e647e86a3c86ebe8cfa5dfc83 /src
parent60420a669ee740dc157efe56d4d43bc4bb6bee19 (diff)
downloadscintilla-mirror-d3bec765b8c185f28bbe9acb515a799ef5d150a0.tar.gz
Fix crash printing on Win32 in bidirectional mode with a non-empty selection.
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx14
1 files changed, 8 insertions, 6 deletions
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<IScreenLineLayout> slLayout = surface->Layout(&screenLine);
- const std::vector<Interval> 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<Interval> 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()) {