Fixed crash on starting in VR mode with V8

This commit is contained in:
ksuprynowicz 2023-03-16 21:50:12 +01:00
parent ceeac40ea8
commit b52fe9a7d5
2 changed files with 6 additions and 0 deletions

View file

@ -163,6 +163,7 @@ ScriptObjectV8Proxy* ScriptObjectV8Proxy::unwrapProxy(const V8ScriptValue& val)
//V8TODO This shouldn't cause problems but I'm not sure if it's ok
//v8::HandleScope handleScope(const_cast<v8::Isolate*>(val.constGetIsolate()));
auto v8Value = val.constGet();
Q_ASSERT(!v8Value.IsEmpty());
if (v8Value->IsNullOrUndefined()) {
return nullptr;
}

View file

@ -83,6 +83,11 @@ V8ScriptValue V8ScriptValueIterator::value() {
if (!_object.Get(isolate)->Get(context, propertyName->ToString(context).ToLocalChecked()).ToLocal(&v8Value)) {
Q_ASSERT(false);
}
//V8TODO: sometimes no value gets written to v8Value. This needs to be investigated and fixed.
if (v8Value.IsEmpty()) {
qDebug() << "V8ScriptValueIterator::value: value handle is empty for key: " << *v8::String::Utf8Value(isolate, propertyName->ToString(context).ToLocalChecked());
v8Value = v8::Undefined(isolate);
}
return V8ScriptValue(_engine, v8Value);
}