about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/prompt.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 77f5df6c4..7246c1268 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-04-21  Oliver Kiddle  <opk@zsh.org>
+
+	* 19806: Src/prompt.c: fix bug with %v expansion and negative index
+
 2004-04-20  Peter Stephenson  <pws@csr.com>
 
 	* 19801: Src/builtin.c: Autoloading of TRAP functions was never
diff --git a/Src/prompt.c b/Src/prompt.c
index 7f964aad5..5e80da172 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -579,7 +579,7 @@ putpromptchar(int doprint, int endchar)
 		    arg = 1;
 		else if (arg < 0)
 		    arg += arrlen(psvar) + 1;
-		if (arrlen(psvar) >= arg)
+		if (arg > 0 && arrlen(psvar) >= arg)
 		    stradd(psvar[arg - 1]);
 		break;
 	    case 'E':