Skip to content

Commit

Permalink
Fix enum <-> byte conversion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
getnamo committed Aug 18, 2022
1 parent 7af9359 commit 4c97f85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion SocketIOClient.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.4.0",
"VersionName": "2.4.1",
"EngineVersion": "5.0.0",
"FriendlyName": "Socket.IO Client",
"Description": "Real-time WebSocket networking via Socket.IO protocol usable from blueprints and c++.",
Expand Down
12 changes: 3 additions & 9 deletions Source/SIOJson/Private/SIOJConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,14 +649,8 @@ TSharedPtr<FJsonValue> USIOJConvert::JsonStringToJsonValue(const FString& JsonSt
//Object
if (JsonString.StartsWith(FString(TEXT("{"))))
{
TSharedPtr< FJsonObject > JsonObject = MakeShareable(new FJsonObject);
TSharedRef< TJsonReader<> > Reader = TJsonReaderFactory<>::Create(*JsonString);
bool success = FJsonSerializer::Deserialize(Reader, JsonObject);

if (success)
{
return MakeShareable(new FJsonValueObject(JsonObject));
}
TSharedPtr< FJsonObject > JsonObject = ToJsonObject(JsonString);
return MakeShareable(new FJsonValueObject(JsonObject));
}

//Array
Expand Down Expand Up @@ -752,7 +746,7 @@ TSharedPtr<FJsonObject> USIOJConvert::ToJsonObject(UStruct* StructDefinition, vo
//Override default enum behavior by fetching display name text
UEnum* EnumDef = BPEnumProperty->Enum;

int32 IntValue = *(int32*)Value;
uint8 IntValue = *(uint8*)Value;

//It's an enum byte
if (EnumDef)
Expand Down

0 comments on commit 4c97f85

Please sign in to comment.