FFeedbackContext::TreatWarningsAsErrors not initialized in UE4Editor

We ran into an issue while trying to enable WarningsAsErrors in our automation tests where UE4Editor always had this flag disabled regardless of command line arguments. It looks like the cause of this problem is that the WarningsAsErrors argument is parsed in FEngineLoop::AppInit() and this sets GWarn->TreatWarningsAsErrors, LaunchEngineLoop.cpp(3730):

if (FParse::Param(FCommandLine::Get(), TEXT("WARNINGSASERRORS")))
	GWarn->TreatWarningsAsErrors = true;

However this instance of GWarn is replaced with UnrealEdWarn later inside FEngineLoop::PreInit() and the value of TreatWarningsAsErrors isn’t copied over. LaunchEngineLoop.cpp(1616):

if (bHasEditorToken)

	// We're the editor.
	GIsClient = true;
	GIsServer = true;
	GIsEditor = true;
	PRIVATE_GIsRunningCommandlet = false;

	GWarn = &UnrealEdWarn;

	FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("Engine", "EditorNotSupported", "Editor not supported in this mode."));
	return 1;
#endif //WITH_EDITOR

To fix this I’ve added the following line directly above where GWarn is reassigned:

	UnrealEdWarn.TreatWarningsAsErrors = GWarn->TreatWarningsAsErrors;

Is this the correct solution? Is there a different preferred way to get the same behavior during testing?