summaryrefslogtreecommitdiffhomepage
path: root/solidity.html.markdown
diff options
context:
space:
mode:
authorNemil Dalal <nemild@gmail.com>2015-11-23 16:07:17 -0500
committerNemil Dalal <nemild@gmail.com>2015-11-23 16:07:17 -0500
commitd5bcbceb21954d0f8739fb841fc511aa32c2bcc6 (patch)
tree8f778658277ee752520c9a30efdf6b7677e94797 /solidity.html.markdown
parent92a736f5e06473d454f197b8017dc542ba8c404c (diff)
Fixed withdrawal check
Diffstat (limited to 'solidity.html.markdown')
-rw-r--r--solidity.html.markdown5
1 files changed, 4 insertions, 1 deletions
diff --git a/solidity.html.markdown b/solidity.html.markdown
index 6409828a..79debed6 100644
--- a/solidity.html.markdown
+++ b/solidity.html.markdown
@@ -49,7 +49,10 @@ contract AcmeBank {
function withdraw(uint withdrawAmount) returns (uint remainingBalance) {
if(balances[msg.sender] >= withdrawAmount) {
balances[msg.sender] -= withdrawAmount;
- balances[msg.sender].send(withdrawAmount);
+
+ if (!balances[msg.sender].send(withdrawAmount)) {
+ balances[msg.sender] += withdrawAmount;
+ }
return balances[msg.sender];
}