I accidentally put the error check into the wrong if statement...

Gavin Howard
From 487eff77b970cf940893dd49bdcd8e29d0423df6 Mon Sep 17 00:00:00 2001
From: Gavin Howard <[email protected]>
Date: Tue, 11 Jun 2019 20:07:43 -0600
Subject: [PATCH] bc: fix previous patch

I put the check into the wrong if. That was my bad. Again.
---
 toys/pending/bc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toys/pending/bc.c b/toys/pending/bc.c
index b38d9872..7698a66b 100644
--- a/toys/pending/bc.c
+++ b/toys/pending/bc.c
@@ -1717,11 +1717,11 @@ static BcStatus bc_num_p(BcNum *a, BcNum *b, BcNum *c, size_t scale) {
   if (b->rdx) return bc_vm_err(BC_ERROR_MATH_NON_INTEGER);
 
   if (!b->len) {
-    if (b->neg) return bc_vm_err(BC_ERROR_MATH_DIVIDE_BY_ZERO);
     bc_num_one(c);
     return BC_STATUS_SUCCESS;
   }
   if (!a->len) {
+    if (b->neg) return bc_vm_err(BC_ERROR_MATH_DIVIDE_BY_ZERO);
     bc_num_setToZero(c, scale);
     return BC_STATUS_SUCCESS;
   }
-- 
2.17.1

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to