Unverified Commit a6a0609b authored by Aditya Arora's avatar Aditya Arora Committed by GitHub

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
parent 1bea4b0d
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment