Fix crash in select_sentence when not selection to end

select_sentence could create a buffer iterator preceeding the
buffer begin, leading to a crash trying to read line -1.
This commit is contained in:
Maxime Coste 2018-02-24 20:22:23 +11:00
parent efce8e0ce6
commit a25d6171d3

View File

@ -485,7 +485,7 @@ select_sentence(const Context& context, const Selection& selection,
auto& buffer = context.buffer();
BufferIterator first = buffer.iterator_at(selection.cursor());
if (not (flags & ObjectFlags::ToEnd))
if (not (flags & ObjectFlags::ToEnd) and first != buffer.begin())
{
BufferIterator prev_non_blank = first-1;
skip_while_reverse(prev_non_blank, buffer.begin(),