commit 03d3b747f9c6708a2df6bb6d6e72aeaf076cd8aa
parent a30a423629f315cb7fbbe1b9c1f65ffaf253f506
Author: sin <sin@2f30.org>
Date: Fri, 16 May 2014 10:43:53 +0100
Bomb out on evaluation errors from plus/diff
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/parser.c b/parser.c
@@ -363,6 +363,8 @@ dodiff(struct object *o, struct object *n)
if (!car(o))
return n;
otmp = eval(car(o));
+ if (otmp->type == OError)
+ return otmp;
if (otmp->type != ONumber)
return error("expected number");
n->d.n.v -= otmp->d.n.v;
@@ -401,6 +403,8 @@ doplus(struct object *o, struct object *n)
if (!car(o))
return n;
otmp = eval(car(o));
+ if (otmp->type == OError)
+ return otmp;
if (otmp->type != ONumber)
return error("expected number");
n->d.n.v += otmp->d.n.v;