mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-15 04:26:37 +00:00
internal/jsre: handle null and undefined to prevent crash (#23701)
This prevents the console from crashing when auto-completing on a variable or property that is null or undefined. Fixes #23693
This commit is contained in:
parent
1bea4b0dfa
commit
a6a0609b05
1 changed files with 1 additions and 1 deletions
|
|
@ -44,7 +44,7 @@ func getCompletions(vm *goja.Runtime, line string) (results []string) {
|
||||||
obj := vm.GlobalObject()
|
obj := vm.GlobalObject()
|
||||||
for i := 0; i < len(parts)-1; i++ {
|
for i := 0; i < len(parts)-1; i++ {
|
||||||
v := obj.Get(parts[i])
|
v := obj.Get(parts[i])
|
||||||
if v == nil {
|
if v == nil || goja.IsNull(v) || goja.IsUndefined(v) {
|
||||||
return nil // No object was found
|
return nil // No object was found
|
||||||
}
|
}
|
||||||
obj = v.ToObject(vm)
|
obj = v.ToObject(vm)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue