Skip to content

Commit

Permalink
vis-lua: check for nil return value of text object callback
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Feb 22, 2017
1 parent 7503d45 commit 335814c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ static Filerange textobject_lua(Vis *vis, Win *win, void *data, size_t pos) {
if (!func_ref_get(L, data) || !obj_ref_new(L, win, "vis.window"))
return text_range_empty();
lua_pushunsigned(L, pos);
if (pcall(vis, L, 2, 2) != 0)
if (pcall(vis, L, 2, 2) != 0 || lua_isnil(L, -1))
return text_range_empty();
return text_range_new(checkpos(L, -2), checkpos(L, -1));
}
Expand Down

0 comments on commit 335814c

Please sign in to comment.