From d691c08d1c7d384b538862d1d8a67cbe6b4c0a0b Mon Sep 17 00:00:00 2001 From: Darkvater Date: Mon, 21 Feb 2005 19:14:16 +0000 Subject: (svn r1895) - Fix: add assert for charwidth getter just in case --- gfx.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gfx.h b/gfx.h index 58cf6dea9..965fd6e04 100644 --- a/gfx.h +++ b/gfx.h @@ -72,7 +72,11 @@ void ToggleFullScreen(const bool full_screen); #define ASCII_LETTERSTART 32 VARDEF int _stringwidth_base; VARDEF byte _stringwidth_table[0x2A0]; -static inline byte GetCharacterWidth(int key) { return _stringwidth_table[key - ASCII_LETTERSTART];} +static inline byte GetCharacterWidth(uint key) +{ + assert(key >= ASCII_LETTERSTART && key - ASCII_LETTERSTART < lengthof(_stringwidth_table)); + return _stringwidth_table[key - ASCII_LETTERSTART]; +} VARDEF DrawPixelInfo _screen; VARDEF DrawPixelInfo *_cur_dpi; -- cgit v1.2.3-70-g09d2