1
Fork 0
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:
Andreas Kling 2020-03-18 15:21:43 +01:00
parent f64f7a4787
commit 97674da502

View file

@ -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);
} }
} }