mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fix(docs/mapping-types): fix wrong demo code.
get index before push, so the access of this index won't beyond the boundery.
This commit is contained in:
parent
602b29cba7
commit
15748e871e
@ -138,8 +138,8 @@ the ``sum`` function iterates over to sum all the values.
|
|||||||
if (keyIndex > 0)
|
if (keyIndex > 0)
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
self.keys.push();
|
|
||||||
keyIndex = self.keys.length;
|
keyIndex = self.keys.length;
|
||||||
|
self.keys.push();
|
||||||
self.data[key].keyIndex = keyIndex + 1;
|
self.data[key].keyIndex = keyIndex + 1;
|
||||||
self.keys[keyIndex].key = key;
|
self.keys[keyIndex].key = key;
|
||||||
self.size++;
|
self.size++;
|
||||||
|
Loading…
Reference in New Issue
Block a user