Possible underflows
This commit is contained in:
parent
c5201fc0a6
commit
fe7c0020e1
|
@ -158,10 +158,13 @@ contract PollManager is Controlled {
|
||||||
uint amount = p.votes[msg.sender];
|
uint amount = p.votes[msg.sender];
|
||||||
if (amount == 0) return;
|
if (amount == 0) return;
|
||||||
|
|
||||||
|
assert(p.voters != 0);
|
||||||
|
assert(amount <= p.results);
|
||||||
|
|
||||||
p.votes[msg.sender] = 0;
|
p.votes[msg.sender] = 0;
|
||||||
|
|
||||||
p.voters--;
|
p.voters--;
|
||||||
p.results -= amount;
|
p.results -= amount;
|
||||||
p.qvResults -= sqrt(amount / 1 ether);
|
p.qvResults -= sqrt(amount / 1 ether);
|
||||||
|
|
||||||
require(MiniMeToken(p.token).transferFrom(address(this), msg.sender, amount));
|
require(MiniMeToken(p.token).transferFrom(address(this), msg.sender, amount));
|
||||||
|
|
Loading…
Reference in New Issue