Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): the credits screen read a height off a font that failed to load

Olcay Seygan8f363d5dccc0
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp
index e770fbae3..7dd91e402 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp
@@ -171,7 +171,10 @@ void CreditsManager::load(void )
TheGlobalLanguageData->adjustFontSize(TheGlobalLanguageData->m_creditsNormalFont.size),
TheGlobalLanguageData->m_creditsNormalFont.bold);
- m_normalFontHeight = font->height;
+ // getFont hands back NULL for a font it could not load - a malformed file, or one the language
+ // data names that is not installed. Every other caller passes the answer straight to setFont,
+ // which checks; this one reads a field off it.
+ m_normalFontHeight = font ? font->height : 0;
}
void CreditsManager::reset( void )