From e58592f00a61fe05a238bc106cd108f8a57ad291 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 19 Jun 2023 12:55:55 +1000 Subject: Fix highlighters being applied to empty display buffers In some cases such as with folding we can end-up with regions not having any atoms to highlight which can trigger a crash as we assume display buffers not to be empty Fixes #4926 --- src/highlighters.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/highlighters.cc b/src/highlighters.cc index d2daa085..ee772469 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1840,6 +1840,9 @@ struct ForwardHighlighterApplier cur_atom = cur_line->begin(); } + if (region_lines.empty()) + return; + region_display.compute_range(); highlighter.highlight(context, region_display, {begin, end}); -- cgit v1.2.3