Skip to content

Commit

Permalink
internal/jsre: handle null and undefined to prevent crash (ethereum#2…
Browse files Browse the repository at this point in the history
…3701)

This prevents the console from crashing when auto-completing on
a variable or property that is null or undefined.

Fixes ethereum#23693
  • Loading branch information
aditya520 authored and zzyalbert committed Nov 26, 2021
1 parent 465c441 commit 7d2c0b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/jsre/completion.go
Expand Up @@ -44,7 +44,7 @@ func getCompletions(vm *goja.Runtime, line string) (results []string) {
obj := vm.GlobalObject()
for i := 0; i < len(parts)-1; i++ {
v := obj.Get(parts[i])
if v == nil {
if v == nil || goja.IsNull(v) || goja.IsUndefined(v) {
return nil // No object was found
}
obj = v.ToObject(vm)
Expand Down

0 comments on commit 7d2c0b2

Please sign in to comment.