From 761063dac4268f31c4264d4f6ea1d62c91183858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 8 Dec 2016 11:50:00 +0100 Subject: vis-lua: only fail file_save_pre event if explicitly returned false Previously we would also interpret a missing return value `nil` as is the case when no pre save event handler is subscribed as failure. --- vis-lua.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index 7318ec3..42196d1 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -2049,7 +2049,7 @@ bool vis_lua_file_save_pre(Vis *vis, File *file, const char *path) { lua_pushstring(L, path); if (pcall(vis, L, 2, 1) != 0) return false; - return lua_toboolean(L, -1); + return !lua_isboolean(L, -1) || lua_toboolean(L, -1); } lua_pop(L, 1); return true; -- cgit v1.2.3