From a25d6171d33efa293cd0fc0b62ad7da807dbb093 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 24 Feb 2018 20:22:23 +1100 Subject: [PATCH] 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. --- src/selectors.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/selectors.cc b/src/selectors.cc index 52c03088..16518279 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -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(),