There’s a bug in the copy constructor, which I think might be part of my problem. Not sure, if there are other bugs involved as well.
TArray<FName> UBaseDialogue::GetBranch()
{
BranchTypes u = dialogues.Find(id)->branch;
FName next;
while(u.HasSubtype<Condition>())
{
next = u.GetSubtype<Condition>()();
u = dialogues.Find(next)->branch; // this line causes the crash
}
NextFragment(next);
return u.GetSubtype<BranchValues>();
}
I tried using BranchTypes &u = dialogues.Find(id)->Branch
, but that didn’t seem to help. I tried using debug logs to see what’s going on, but those just prevent the crash from happening in the first place. How could I go about making this while loop not lead to a crash? Would the move constructor be the correct approach?