From 2cea55c6e65e4ea7f735655b45d917b76e8b7945 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 30 Jul 2019 17:19:57 -0400 Subject: Fail more gracefully when attempting to create buffers on init. --- src/textadept.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/textadept.c b/src/textadept.c index 0aef64b8..a8a29c7c 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1100,6 +1100,7 @@ static int lbuffer_delete(lua_State *L) { /** `_G.buffer_new()` Lua function. */ static int lbuffer_new(lua_State *L) { + if (initing) luaL_error(L, "cannot create buffers during initialization"); new_buffer(0); lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers"); return (lua_rawgeti(L, -1, lua_rawlen(L, -1)), 1); -- cgit v1.2.3