about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJun T <takimoto-j@kba.biglobe.ne.jp>2014-03-13 21:31:59 +0900
committerPeter Stephenson <pws@zsh.org>2014-03-13 16:29:19 +0000
commitba44ba6e6fa99582c681cfc69ce4f77838af2bb6 (patch)
tree8bb6b60240ba07eedaa86e646ef9de975fb4f51d
parent38be9fe84a884d44c30bbcea0595799882aff898 (diff)
downloadzsh-ba44ba6e6fa99582c681cfc69ce4f77838af2bb6.tar.gz
zsh-ba44ba6e6fa99582c681cfc69ce4f77838af2bb6.tar.xz
zsh-ba44ba6e6fa99582c681cfc69ce4f77838af2bb6.zip
32480: Fix crash in vi mode with too few previous changes
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_vi.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5aeacd26b..d89214af7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-13  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* Jun T: 32480: Src/Zle/zle_vi.c: fix crash in vi mode when too
+	few previous changes.
+
 2014-03-09  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 32468: Src/Modules/zutil.c: save/restore match/mbegin/mend
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 994b44fe3..9e39143d0 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -401,7 +401,7 @@ vichange(UNUSED(char **args))
 	forekill(c2 - zlecs, CUT_RAW);
 	selectkeymap("main", 1);
 	viinsbegin = zlecs;
-	vistartchange = curchange->prev->changeno;
+	vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0;
     }
     return ret;
 }