Skip to content

Commit

Permalink
vis-lua: fail when mapping a key to an invalid handler type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
devkarthin authored and rnpnr committed Oct 5, 2023
1 parent 312a16e commit 3d83d77
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3d83d77

Please sign in to comment.