- Fixed: DrawHudText() needs to verify that the character glyph is valid before accessing

its fields.

SVN r2182 (trunk)
This commit is contained in:
Randy Heit 2010-03-02 01:59:16 +00:00
parent 54b792a97f
commit 4e2ca33ea9

View file

@ -168,12 +168,15 @@ static void DrawHudText(FFont *font, int color, char * text, int x, int y, int t
{ {
int width; int width;
FTexture *texc = font->GetChar(text[i], &width); FTexture *texc = font->GetChar(text[i], &width);
if (texc != NULL)
{
int offset = texc->TopOffset - tex_zero->TopOffset + tex_zero->GetHeight(); int offset = texc->TopOffset - tex_zero->TopOffset + tex_zero->GetHeight();
screen->DrawChar(font, color, x, y, text[i], screen->DrawChar(font, color, x, y, text[i],
DTA_KeepRatio, true, DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans,
DTA_LeftOffset, width/2, DTA_TopOffset, offset, DTA_LeftOffset, width/2, DTA_TopOffset, offset,
/*DTA_CenterBottomOffset, 1,*/ TAG_DONE); /*DTA_CenterBottomOffset, 1,*/ TAG_DONE);
}
x += zerowidth; x += zerowidth;
} }
} }
@ -181,7 +184,7 @@ static void DrawHudText(FFont *font, int color, char * text, int x, int y, int t
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Draws a numberses a fixed widh for all characters // Draws a number with a fixed width for all digits
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------