From 3d83d7716926a7296bbb0d6bb59371a9a5d66955 Mon Sep 17 00:00:00 2001 From: Karthin Srinavakili Date: Mon, 4 Sep 2023 13:31:48 -0400 Subject: vis-lua: fail when mapping a key to an invalid handler type When passing an invalid handler type (i.e., any type that isn't a string, function, or KeyAction) to Vis:map/Window:map, the editor would map the key to an empty (zeroed) KeyBinding struct. vis_keys_process() doesn't take this into account, so the key is never consumed from the input queue, causing the editor to get stuck in an infinite loop. --- vis-lua.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index a92b186..62c0e4c 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -832,6 +832,8 @@ static int keymap(lua_State *L, Vis *vis, Win *win) { goto err; } else if (lua_isuserdata(L, 4)) { binding->action = obj_ref_check(L, 4, VIS_LUA_TYPE_KEYACTION); + } else { + goto err; } if (win) { -- cgit v1.2.3