diff options
| author | Peter Stephenson <pws@zsh.org> | 2015-04-15 10:20:06 +0100 |
|---|---|---|
| committer | Peter Stephenson <pws@zsh.org> | 2015-04-15 10:20:06 +0100 |
| commit | 2ef4b38461dfb554ed2226d9de8958703bc00b98 (patch) | |
| tree | 0211f4c597eb0d95310b95b57191fc64fca79b4e /Src/math.c | |
| parent | 34887: Fix POSIX_BUILTINS with assignment. (diff) | |
| download | zsh-2ef4b38461dfb554ed2226d9de8958703bc00b98.tar zsh-2ef4b38461dfb554ed2226d9de8958703bc00b98.tar.gz zsh-2ef4b38461dfb554ed2226d9de8958703bc00b98.tar.bz2 zsh-2ef4b38461dfb554ed2226d9de8958703bc00b98.tar.lz zsh-2ef4b38461dfb554ed2226d9de8958703bc00b98.tar.xz zsh-2ef4b38461dfb554ed2226d9de8958703bc00b98.tar.zst zsh-2ef4b38461dfb554ed2226d9de8958703bc00b98.zip | |
34892 (slightly tweaked): math evaluation fix
An empty expression resulting from substitution includes a
Nularg, which needs handling the same as an empty string.
Diffstat (limited to 'Src/math.c')
| -rw-r--r-- | Src/math.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Src/math.c b/Src/math.c index c047725c5..2105180c8 100644 --- a/Src/math.c +++ b/Src/math.c @@ -1398,7 +1398,7 @@ matheval(char *s) if (!mlevel) outputradix = outputunderscore = 0; - if (!*s) { + if (!*s || *s == Nularg) { x.type = MN_INTEGER; x.u.l = 0; return x; @@ -1435,7 +1435,7 @@ mathevalarg(char *s, char **ss) * * To avoid a more opaque error further in, bail out here. */ - if (!*s) { + if (!*s || *s == Nularg) { zerr("bad math expression: empty string"); return (zlong)0; } |
