mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-19 00:10:56 +01:00
34892 (slightly tweaked): math evaluation fix
An empty expression resulting from substitution includes a Nularg, which needs handling the same as an empty string.
This commit is contained in:
parent
a2c579050f
commit
2ef4b38461
3 changed files with 9 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue