mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:57:35 +00:00
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:
parent
f64f7a4787
commit
97674da502
1 changed files with 5 additions and 2 deletions
|
@ -42,8 +42,11 @@ NativeFunction::~NativeFunction()
|
||||||
Value NativeFunction::call(Interpreter& interpreter, const Vector<Value>& arguments)
|
Value NativeFunction::call(Interpreter& interpreter, const Vector<Value>& arguments)
|
||||||
{
|
{
|
||||||
auto this_value = interpreter.this_value();
|
auto this_value = interpreter.this_value();
|
||||||
ASSERT(this_value.is_object());
|
// FIXME: Why are we here with a non-object 'this'?
|
||||||
return m_native_function(this_value.as_object(), arguments);
|
Object* this_object = nullptr;
|
||||||
|
if (this_value.is_object())
|
||||||
|
this_object = this_value.as_object();
|
||||||
|
return m_native_function(this_object, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue