C++ Widget Component UpdateRenderTarget in construction script fails on package

Hello,
I want to get the render target from a C++ added widget component in the construction script in the editor and begin play in a packaged game (I am doing a burn in for a camera that works in both runtime and editor mode)
Right now I can get all versions of the code to work, editor mode, editor play mode, and standalone packaged build
However, when I go to package I have to comment out this line in my construction script or the build will fail:

#if WITH_EDITOR
BurnInWidgetComponent->UpdateRenderTarget(2048.0f);
#endif

I thought wrapping it with an #if WITH_EDITOR block would fix the issue, but it still gets called somehow and gives a fatal error on build.

Is there something I am missing with #WITH_EDITOR that is allowing the packaging tool to bypass it? Elsewhere in my code I use it macro with no issues.

Thanks!

I solved the issue by making sure the widget portion of the widget component was valid
if (IsValid(BurnInWidgetComponent)) {
if (IsValid(BurnInWidgetComponent->GetWidget())) {
BurnInWidgetComponent->UpdateRenderTarget(2048.0f);
}
}

I had just been making sure the widget component was valid before