summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/hist.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f3985b870..161303261 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-22  Peter Stephenson  <pws@csr.com>
+
+	* Rocky Bernstein: 25696: Src/hist.c: fix crash on empty history.
+
 2008-09-21  Clint Adams  <clint@zsh.org>
 
 	* unposted: Completion/Linux/Command/.distfiles: update .distfiles.
diff --git a/Src/hist.c b/Src/hist.c
index 55131f06e..65812dc91 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -945,7 +945,7 @@ movehistent(Histent he, int n, int xflags)
 mod_export Histent
 up_histent(Histent he)
 {
-    return he->up == hist_ring? NULL : he->up;
+    return !he || he->up == hist_ring? NULL : he->up;
 }
 
 /**/