forked from TrueCloudLab/neoneo-go
vm: fix bug in GetContextScriptHash()
v.Istack.Peek(n) can return nil pointer, so .Value() on this pointer leads to panic here. Fixed by adding nil check.
This commit is contained in:
parent
d1ec01c45e
commit
9ecac14aee
1 changed files with 5 additions and 1 deletions
|
@ -226,7 +226,11 @@ func (c *Context) String() string {
|
|||
// GetContextScriptHash returns script hash of the invocation stack element
|
||||
// number n.
|
||||
func (v *VM) GetContextScriptHash(n int) util.Uint160 {
|
||||
ctxIface := v.Istack().Peek(n).Value()
|
||||
element := v.Istack().Peek(n)
|
||||
if element == nil {
|
||||
return util.Uint160{}
|
||||
}
|
||||
ctxIface := element.Value()
|
||||
ctx := ctxIface.(*Context)
|
||||
return ctx.ScriptHash()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue