summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-06-18 19:51:04 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-06-18 19:51:04 +0100
commitfce2a216901a39fea88fbf76d46286d7e494b68b (patch)
treec801ccf9d528ddf7fa64ad5079e632fc9f757696 /src
parentbf46870ff24238099e9d304575a35738f5526518 (diff)
Fix segfault on g. when last modification position past buffer end
Diffstat (limited to 'src')
-rw-r--r--src/normal.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/normal.cc b/src/normal.cc
index e94ef106..6a936f82 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -230,7 +230,9 @@ void goto_commands(Context& context, NormalParams params)
{
context.push_jump();
auto pos = buffer.last_modification_coord();
- if (buffer[pos.line].length() == pos.column + 1)
+ if (pos >= buffer.back_coord())
+ pos = buffer.back_coord();
+ else if (buffer[pos.line].length() == pos.column + 1)
pos = ByteCoord{ pos.line+1, 0 };
select_coord<mode>(buffer, pos, context.selections());
break;