contract NumberList {
uint256[] public bigNumberList;
}
An error is generated when attempting to call the associated getter function for bigNumberList
while the array is empty. E.g bigNumberList(0)
generates an error. Once I've added a number to the array however, I'm able to call the getter function without any issues.
From remix the error looks like this:
call to NumberList.bigNumberList CALL [call]from: 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4to: NumberList.bigNumberList(uint256)data: 0x35b...00000 from 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 to NumberList.bigNumberList(uint256) 0xDA0bab807633f07f013f94DD0E6A4F96F8742B53 execution cost 23744 gas (Cost only applies when called by a contract) input 0x35b...00000 decoded input { "uint256 ": "0" } decoded output { "0": "uint256: 0" } logs [] call to NumberList.bigNumberList errored: VM error: revert.
revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
As you can see the decoded output above is actually correct but I'm currently not understanding why calling the function should produce an error?