How to stop crash when trying to SEditableTextBox::SetStyle()

I have tried my best to figure this one out, I even started learning how to use the debugger but I still don’t understand what I am doing wrong.

I am trying to set the style on a SEditableTextBox but the way that I am trying to do that results in a crash.

The RobotoFont UFont is being fed into SCheatMenuWidget by a slate argument at creation from the MenuHUD. This was changed from how you will see Cactus Font loaded in SCheatMenuWidget.cpp

MenuHUD.cpp

AMenuHUD::AMenuHUD() 
{
    static ConstructorHelpers::FObjectFinder<UFont> FontObject(TEXT("Font'/Engine/EngineFonts/Roboto.Roboto'"));
    if(FontObject.Object)
    {
        RobotoFont = FontObject.Object;
    }
}

SCheatMenuWidget.cpp

void SCheatMenuWidget::Construct(const FArguments& InArgs) 
{
    bCanSupportFocus = true;

    OwningHUD = InArgs._OwningHUD;
    MyGameInstance = InArgs._MyGameInstance;
    RobotoFont = InArgs._RobotoFont;
 
    // FONT SETTINGS
    // Cactus Font
    const FCompositeFont FontToChoose = FCompositeFont(FName(TEXT("Cactus")), FPaths::ProjectContentDir() / "Fonts/Cactus.otf",
    EFontHinting::Default, EFontLoadingPolicy::LazyLoad);

    TSharedPtr<const FCompositeFont> ChosenFont(new FCompositeFont(FontToChoose));

    // Roboto Font
    if(!RobotoFont.IsValid()) {UE_LOG(LogTemp, Error, TEXT("RobotoFont is not valid!")); return;}
const FCompositeFont CheatFontToChoose = RobotoFont->CompositeFont;

    TSharedPtr<const FCompositeFont> ChosenCheatFont(new FCompositeFont(CheatFontToChoose));
    ......

    .....
    FFontOutlineSettings TextOutline;
    TextOutline.OutlineColor = FColor::Black;
    TextOutline.OutlineSize = 1;
    // Default Text Style
    FSlateFontInfo ButtonTextStyle = FCoreStyle::Get().GetFontStyle("EmbossedText");
    ButtonTextStyle.CompositeFont = ChosenFont;
    ButtonTextStyle.Size = 40.f;
    ButtonTextStyle.OutlineSettings = TextOutline;
    ButtonTextStyle.TypefaceFontName = TEXT("Cactus");

    // Cheat Style Settings
    FSlateFontInfo CheatTextStyle = ButtonTextStyle;
    CheatTextStyle.FontObject = Cast<UObject>(RobotoFont); // This was to try to resolve the issue. Probably wrong.
    CheatTextStyle.CompositeFont = ChosenCheatFont;
    CheatTextStyle.TypefaceFontName = TEXT("Roboto");

    const FEditableTextBoxStyle TextBoxStyle = FEditableTextBoxStyle()
    .SetFont(CheatTextStyle)
    .SetPadding(FMargin(0.f));
.....

.....
 // Cheat Text Box
                + SConstraintCanvas::Slot()
                .Anchors(FAnchors(.4f, .6f, .6f, .45f))
                [
                    SNew(SScaleBox)
                    .HAlign(HAlign_Center)
                    .VAlign(VAlign_Center)
                    .Stretch(EStretch::ScaleToFit)
                    [
                        SAssignNew(CheatBox, SEditableTextBox)
                        .OnTextCommitted(this, &SCheatMenuWidget::OnCheatEntered)
                        .Style(&TextBoxStyle) // Commenting this out resolves the crash.
                        //.Style(TextBlockStyle) // Does not compile.
                    ]
                ]

This is my crash report

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION writing address 0x00000000c0fc0008

UE4Editor_SlateCore!FSlateFontInfo::FSlateFontInfo()
UE4Editor_Slate!SEditableTextBox::DetermineFont() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Public\Widgets\Input\SEditableTextBox.h:422]
UE4Editor_Slate!TBaseSPMethodDelegateInstance<1,SEditableTextBox const ,0,FSlateFontInfo __cdecl(void),FDefaultDelegateUserPolicy>::Execute() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:290]
UE4Editor_Slate!TAttribute<FSlateFontInfo>::Get() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Misc\Attribute.h:160]
UE4Editor_Slate!SEditableText::SynchronizeTextStyle() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Widgets\Input\SEditableText.cpp:431]
UE4Editor_Slate!SEditableText::CacheDesiredSize() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Widgets\Input\SEditableText.cpp:116]
UE4Editor_SlateCore!SWidget::Prepass_Internal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:1544]
UE4Editor_SlateCore!SWidget::Prepass_Internal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:1528]
UE4Editor_SlateCore!SWidget::Prepass_Internal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:1528]
UE4Editor_SlateCore!SWidget::Prepass_Internal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:1528]
UE4Editor_SlateCore!SWidget::SlatePrepass() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:646]
UE4Editor_Slate!SScaleBox::CustomPrepass() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Widgets\Layout\SScaleBox.cpp:67]
UE4Editor_SlateCore!SWidget::Prepass_Internal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:1510]
UE4Editor_SlateCore!SWidget::Prepass_Internal() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:1528]
UE4Editor_SlateCore!SWidget::Prepass_Internal() (Many Identical Lines Removed)[D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:1528]
UE4Editor_SlateCore!SWidget::SlatePrepass() [D:\Build\++UE4\Sync\Engine\Source\Runtime\SlateCore\Private\Widgets\SWidget.cpp:646]
UE4Editor_Slate!PrepassWindowAndChildren() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:1139]
UE4Editor_Slate!FSlateApplication::DrawPrepass() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:1188]
UE4Editor_Slate!FSlateApplication::PrivateDrawWindows() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:1235]
UE4Editor_Slate!FSlateApplication::DrawWindows() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:1017]
UE4Editor_Slate!FSlateApplication::TickAndDrawWidgets() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:1569]
UE4Editor_Slate!FSlateApplication::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:1423]
UE4Editor!FEngineLoop::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4948]
UE4Editor!GuardedMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
UE4Editor!GuardedMainWrapper() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!WinMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Thanks!

The way this crash was resolved was by declaring TextBoxStyle in the widgets header file.