- 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,20 +168,23 @@ 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);
int offset = texc->TopOffset - tex_zero->TopOffset + tex_zero->GetHeight(); if (texc != NULL)
screen->DrawChar(font, color, x, y, text[i], {
DTA_KeepRatio, true, int offset = texc->TopOffset - tex_zero->TopOffset + tex_zero->GetHeight();
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, screen->DrawChar(font, color, x, y, text[i],
DTA_LeftOffset, width/2, DTA_TopOffset, offset, DTA_KeepRatio, true,
/*DTA_CenterBottomOffset, 1,*/ TAG_DONE); DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans,
x+=zerowidth; 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
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------