You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In UnrealJS\Source\V8\Private\JavascriptIsolate_Private.cpp, in FJavascriptIsolateImplementation, in InternalReadProperty, in the else if(auto p = CastField<FEnumProperty>(Property)) branch, the following code is incorrect:
int32 Value = p->GetUnderlyingProperty()->GetValueTypeHash(Buffer);
return I.Keyword(p->GetEnum()->GetNameStringByIndex(Value));
Unlike the other branches, which call p->GetPropertyValue_InContainer(Buffer), this branch does not factor in the property's offset within the buffer (stored in Offset_Internal). This means it interprets whatever is at the head of the buffer as the property's value, resulting in incorrect return values in JS when calling a C++ method that returns an enum.
Locally, I'm using this and it seems to work:
int32 Value = p->GetUnderlyingProperty()->GetValueTypeHash(Buffer + p->GetOffset_ForInternal());
return I.Keyword(p->GetEnum()->GetNameStringByIndex(Value));
The text was updated successfully, but these errors were encountered:
getnamo
added a commit
to getnamo/UnrealJs
that referenced
this issue
Aug 17, 2020
In
UnrealJS\Source\V8\Private\JavascriptIsolate_Private.cpp
, inFJavascriptIsolateImplementation
, inInternalReadProperty
, in theelse if(auto p = CastField<FEnumProperty>(Property))
branch, the following code is incorrect:Unlike the other branches, which call
p->GetPropertyValue_InContainer(Buffer)
, this branch does not factor in the property's offset within the buffer (stored inOffset_Internal
). This means it interprets whatever is at the head of the buffer as the property's value, resulting in incorrect return values in JS when calling a C++ method that returns an enum.Locally, I'm using this and it seems to work:
The text was updated successfully, but these errors were encountered: