Need help with this error

Why doesn’t this code work?

static ConstructorHelpers::FObjectFinder<UWidgetBlueprint> WidgetContainer(TEXT("/Game/Widgets/LockOnIndicator.LockOnIndicator"));
		if (WidgetContainer.Succeeded())
		{
			LockedOnWidget->SetWidgetClass(WidgetContainer.Object->GeneratedClass);
		}

It would be helpful if you could provide
(A) the actual error message and
(B) where the code is called, e.g. is it in a constructor, normal method, or somewhere entirely different?

Dw its solved ty for the reply tho.