From 8cfe16c06f62b8b0bbb29ffc23df9d1eb9d342f1 Mon Sep 17 00:00:00 2001 From: Terry Michaels <81711813+tjmichaels@users.noreply.github.com> Date: Tue, 18 May 2021 11:42:31 -0500 Subject: [PATCH] Added null check for m_font (#801) --- Gems/LyShine/Code/Source/UiTextComponent.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index 937f323b01..648013108b 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -3568,13 +3568,14 @@ UiTextComponent::FontEffectComboBoxVec UiTextComponent::PopulateFontEffectList() FontEffectComboBoxVec result; AZStd::vector entityIdList; - // there is always a valid font since we default to "default-ui" - // so just get the effects from the font and add their names to the result list - unsigned int numEffects = m_font->GetNumEffects(); - for (int i = 0; i < numEffects; ++i) + if (m_font) { - const char* name = m_font->GetEffectName(i); - result.push_back(AZStd::make_pair(i, name)); + unsigned int numEffects = m_font->GetNumEffects(); + for (int i = 0; i < numEffects; ++i) + { + const char* name = m_font->GetEffectName(i); + result.push_back(AZStd::make_pair(i, name)); + } } return result;