From: Alan Cox Date: Thu, 31 May 2018 23:48:31 +0000 (+0100) Subject: dc: fix handling of error case for div/mod X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=efbaa715b7f794274b7cf1e8130a77cf57bf8d01;p=FUZIX.git dc: fix handling of error case for div/mod NULL is not the right return --- diff --git a/Applications/V7/cmd/dc.c b/Applications/V7/cmd/dc.c index 7459709d..47f7b7b5 100644 --- a/Applications/V7/cmd/dc.c +++ b/Applications/V7/cmd/dc.c @@ -774,8 +774,8 @@ struct blk *div(struct blk *ddivd, struct blk *ddivr) p = salloc(0); if (length(ddivr) == 0) { pushp(ddivr); - /* BUG: this returns NULL, which will cause a crash later */ - errorrt("divide by 0\n"); + puts("divide by 0"); + return 1; } divsign = remsign = 0; divr = ddivr; @@ -915,8 +915,8 @@ int dscale(void) if (sfbeg(dr) == 1 || (sfbeg(dr) == 0 && sbackc(dr) == 0)) { sputc(dr, skr); pushp(dr); - /* BUG: this returns NULL, which will cause a crash later */ - errorrt("divide by 0\n"); + puts("divide by 0"); + return 1; } c = k - skd + skr; if (c < 0)