about summary refs log tree commit diff
path: root/Src/math.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-12-18 18:07:49 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-12-18 18:07:49 +0000
commit99c9b50bb491e8e19774458e82bc9540f6d223f2 (patch)
treea24d5f8222316112e99d847820477c059c404e60 /Src/math.c
parent9a8dfbb7b5ac843c7ae8dd12339911c0ea8103fb (diff)
downloadzsh-99c9b50bb491e8e19774458e82bc9540f6d223f2.tar.gz
zsh-99c9b50bb491e8e19774458e82bc9540f6d223f2.tar.xz
zsh-99c9b50bb491e8e19774458e82bc9540f6d223f2.zip
18015: empty math parse acts like zero
Diffstat (limited to 'Src/math.c')
-rw-r--r--Src/math.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/math.c b/Src/math.c
index 766dff679..bc0669b7e 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -961,7 +961,7 @@ mathevall(char *s, int prek, char **ep)
     stack[0].val.u.l = 0;
     mathparse(prek);
     *ep = ptr;
-    DPUTS(!errflag && sp,
+    DPUTS(!errflag && sp > 0,
 	  "BUG: math: wallabies roaming too freely in outback");
 
     if (errflag) {
@@ -1084,6 +1084,9 @@ mathparse(int pc)
     if (errflag)
 	return;
     mtok = zzlex();
+    /* Handle empty input */
+    if (pc == TOPPREC && mtok == EOI)
+	return;
     checkunary(mtok, optr);
     while (prec[mtok] <= pc) {
 	if (errflag)