aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-23 18:04:27 +0800
committerobscuren <geffobscura@gmail.com>2014-07-23 18:04:27 +0800
commit06ec80f39495bdd92878468cf862f52e9748f1ca (patch)
tree85f917581ef39480b5078c591cb616beafefaba6
parent6774ddaba29ae9e9db5065ce74055297b948adf9 (diff)
downloadgo-tangerine-06ec80f39495bdd92878468cf862f52e9748f1ca.tar
go-tangerine-06ec80f39495bdd92878468cf862f52e9748f1ca.tar.gz
go-tangerine-06ec80f39495bdd92878468cf862f52e9748f1ca.tar.bz2
go-tangerine-06ec80f39495bdd92878468cf862f52e9748f1ca.tar.lz
go-tangerine-06ec80f39495bdd92878468cf862f52e9748f1ca.tar.xz
go-tangerine-06ec80f39495bdd92878468cf862f52e9748f1ca.tar.zst
go-tangerine-06ec80f39495bdd92878468cf862f52e9748f1ca.zip
zero devision check
-rw-r--r--ethchain/vm.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/ethchain/vm.go b/ethchain/vm.go
index 528088a49..07e9a0f2c 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -306,7 +306,9 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
x, y := stack.Popn()
vm.Printf(" %v / %v", y, x)
- base.Div(y, x)
+ if x.Cmp(ethutil.Big0) != 0 {
+ base.Div(y, x)
+ }
vm.Printf(" = %v", base)
// Pop result back on the stack