(svn r1895) - Fix: add assert for charwidth getter just in case
authorDarkvater
Mon, 21 Feb 2005 19:14:16 +0000
changeset 1391 1325047def14
parent 1390 53a5713cf3f9
child 1392 7b08188ca3be
(svn r1895) - Fix: add assert for charwidth getter just in case
gfx.h
--- a/gfx.h	Mon Feb 21 18:59:54 2005 +0000
+++ b/gfx.h	Mon Feb 21 19:14:16 2005 +0000
@@ -72,7 +72,11 @@
 #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;