From 4e2ca33ea924f408b6730de03e31464229e99f60 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 2 Mar 2010 01:59:16 +0000 Subject: [PATCH] - Fixed: DrawHudText() needs to verify that the character glyph is valid before accessing its fields. SVN r2182 (trunk) --- src/g_shared/shared_hud.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 87664c204f..31dc116a6f 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -168,20 +168,23 @@ static void DrawHudText(FFont *font, int color, char * text, int x, int y, int t { int width; FTexture *texc = font->GetChar(text[i], &width); - int offset = texc->TopOffset - tex_zero->TopOffset + tex_zero->GetHeight(); - screen->DrawChar(font, color, x, y, text[i], - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, - DTA_LeftOffset, width/2, DTA_TopOffset, offset, - /*DTA_CenterBottomOffset, 1,*/ TAG_DONE); - x+=zerowidth; + if (texc != NULL) + { + int offset = texc->TopOffset - tex_zero->TopOffset + tex_zero->GetHeight(); + screen->DrawChar(font, color, x, y, text[i], + DTA_KeepRatio, true, + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, + DTA_LeftOffset, width/2, DTA_TopOffset, offset, + /*DTA_CenterBottomOffset, 1,*/ TAG_DONE); + } + x += zerowidth; } } //--------------------------------------------------------------------------- // -// Draws a numberses a fixed widh for all characters +// Draws a number with a fixed width for all digits // //---------------------------------------------------------------------------