Fix crash on non utf8 files trigering highlighting of backward ranges

Fixes #1274
This commit is contained in:
Maxime Coste 2017-03-09 23:40:34 +00:00
parent a0b42323ed
commit 0faa5567ca

View File

@ -30,7 +30,8 @@ void highlight_range(DisplayBuffer& display_buffer,
BufferCoord begin, BufferCoord end, BufferCoord begin, BufferCoord end,
bool skip_replaced, T func) bool skip_replaced, T func)
{ {
if (begin == end or end <= display_buffer.range().begin // tolerate begin > end as that can be triggered by wrong encodngs
if (begin >= end or end <= display_buffer.range().begin
or begin >= display_buffer.range().end) or begin >= display_buffer.range().end)
return; return;