From 066a1eddf509822a5ac5c143b6c2e778e32f163e Mon Sep 17 00:00:00 2001 From: mbalfour Date: Thu, 6 May 2021 13:42:52 -0500 Subject: [PATCH] Moved null check before setting the status to "initializing". Otherwise, if the first call to InitFont() is with a null render scene, the status will get stuck in initializing forever and fonts will never render. This does NOT fix the text being drawn in the wrong location, that's a separate bug. --- Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp index d36307e4ec..40684640d6 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp @@ -101,6 +101,11 @@ AZ::RPI::WindowContextSharedPtr AZ::FFont::GetDefaultWindowContext() const bool AZ::FFont::InitFont(AZ::RPI::Scene* renderScene) { + if (!renderScene) + { + return false; + } + auto initializationState = InitializationState::Uninitialized; // Do an atomic transition to Initializing if we're in the Uninitialized state. // Otherwise, check the current state. @@ -111,11 +116,6 @@ bool AZ::FFont::InitFont(AZ::RPI::Scene* renderScene) return initializationState == InitializationState::Initialized; } - if (!renderScene) - { - return false; - } - // Create and initialize DynamicDrawContext for font draw AZ::RPI::Ptr dynamicDraw = m_atomFont->GetOrCreateDynamicDrawForScene(renderScene);