Skip to content

Commit b3227a3

Browse files
committed
fix(w3d): Simplify null bold font guard
1 parent c99e3a8 commit b3227a3

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ void W3DDisplayString::setFont( GameFont *font )
306306
// set the font in our renderer
307307
m_textRenderer.Set_Font( static_cast<FontCharsClass *>(m_font->fontData) );
308308

309-
// TheSuperHackers @fix bobtista 19/07/2026 Guard against null bold font to prevent crash when font loading fails
310-
GameFont *boldFont = TheFontLibrary->getFont( font->nameString, font->pointSize, TRUE );
311-
if( boldFont != nullptr )
309+
if( GameFont *boldFont = TheFontLibrary->getFont( font->nameString, font->pointSize, TRUE ) )
312310
{
313311
m_textRendererHotKey.Set_Font( static_cast<FontCharsClass *>(boldFont->fontData) );
314312
}

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ void W3DDisplayString::setFont( GameFont *font )
306306
// set the font in our renderer
307307
m_textRenderer.Set_Font( static_cast<FontCharsClass *>(m_font->fontData) );
308308

309-
// TheSuperHackers @fix bobtista 19/07/2026 Guard against null bold font to prevent crash when font loading fails
310-
GameFont *boldFont = TheFontLibrary->getFont( font->nameString, font->pointSize, TRUE );
311-
if( boldFont != nullptr )
309+
if( GameFont *boldFont = TheFontLibrary->getFont( font->nameString, font->pointSize, TRUE ) )
312310
{
313311
m_textRendererHotKey.Set_Font( static_cast<FontCharsClass *>(boldFont->fontData) );
314312
}

0 commit comments

Comments
 (0)