From: Alexis Laferrière Date: Thu, 14 Sep 2017 17:48:19 +0000 (-0400) Subject: gamnit: fix crash on character missing from font X-Git-Url: http://nitlanguage.org?hp=2163c2d8ce1cccf8bc6cac44e9e5587fc92fb786 gamnit: fix crash on character missing from font Signed-off-by: Alexis Laferrière --- diff --git a/lib/gamnit/bmfont.nit b/lib/gamnit/bmfont.nit index c2c8be5..a7afc56 100644 --- a/lib/gamnit/bmfont.nit +++ b/lib/gamnit/bmfont.nit @@ -477,6 +477,13 @@ class BMFontAsset var w = text[wi] if w == '\n' or w == pld or w == plu or w.is_whitespace or (in_link and w == ']') then break + + if not desc.chars.keys.has(w) then + var rc = replacement_char + if rc == null then continue + w = rc + end + word_len += advance(prev_w, w) * scale prev_w = w end