LibJS: Tolerate NativeFunction::call() with non-object 'this' for now

I'm not exactly sure why we end up in this situation, we'll have to
look into it.
This commit is contained in:
Andreas Kling 2020-03-18 15:21:43 +01:00
parent f64f7a4787
commit 97674da502
Notes: sideshowbarker 2024-07-19 08:15:32 +09:00

View file

@ -42,8 +42,11 @@ NativeFunction::~NativeFunction()
Value NativeFunction::call(Interpreter& interpreter, const Vector<Value>& arguments)
{
auto this_value = interpreter.this_value();
ASSERT(this_value.is_object());
return m_native_function(this_value.as_object(), arguments);
// FIXME: Why are we here with a non-object 'this'?
Object* this_object = nullptr;
if (this_value.is_object())
this_object = this_value.as_object();
return m_native_function(this_object, arguments);
}
}