From f406e9bbb57c89e3d6c58710dcbb91316664bda5 Mon Sep 17 00:00:00 2001 From: LJ Sonic <lamr@free.fr> Date: Wed, 3 Apr 2024 20:39:53 +0200 Subject: [PATCH] Throw a Lua error when R_Frame2Char is called with a frame number without character representation --- src/lua_baselib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 9e4eebeb08..f6b8f462b5 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3030,6 +3030,9 @@ static int lib_rFrame2Char(lua_State *L) //HUDSAFE c[0] = R_Frame2Char(ch); + if (c[0] == '\xFF') + return luaL_error(L, "frame %u cannot be represented by a character", ch); + c[1] = 0; lua_pushstring(L, c); -- GitLab