vm: catch stack underflow on Peek()
This commit is contained in:
parent
4ee387d077
commit
807bd662b2
|
@ -104,6 +104,10 @@ func (st *Stack) Dup(n int) {
|
|||
|
||||
// Not an opcode, costs no gas.
|
||||
func (st *Stack) Peek() Word256 {
|
||||
if st.ptr == 0 {
|
||||
st.setErr(ErrDataStackUnderflow)
|
||||
return Zero256
|
||||
}
|
||||
return st.data[st.ptr-1]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue