Serializing a Json to FString sometimes seams to crash my game. It can happen randomly on many occasions, I suspect it having something to do with framerate drops or when something is spawned:
FString UArin_GameSave::GetTextToSave(
TSharedPtr<FJsonObject> pJsonObject)
{
FString ReturnedValue = "";
//Validate JsonObject
if (!pJsonObject.IsValid())
{
UE_LOG(LogTemp, Log, TEXT("UArin_GameSave::GetTextToSave: LoadedDataslotData is invalid"));
return "";
}
//Prepare Serializing
TSharedRef<TJsonWriter<>> Writer = TJsonWriterFactory<>::Create(&ReturnedValue);
//Serialize
FJsonSerializer::Serialize(
pJsonObject.ToSharedRef(), //Data that gets serialized
Writer); //The writer which outputs it to the ReturnedValue
return ReturnedValue; // <-- The crash report always reports this line
}
Does anyone have an idea what could be the cause?