lua: complain loudly if Lua state creation fails

This should normally happen only if memory allocation for the state
happens, which should be extremely rare. But with Luajit on OSX, it can
happen if the magic compiler flags required by Luajit were not passed to
mpv compilation. Print an error to reduce confusion.
This commit is contained in:
wm4 2016-09-25 01:00:20 +02:00
parent 733218b233
commit cad6fb038b
1 changed files with 3 additions and 1 deletions

View File

@ -377,8 +377,10 @@ static int load_lua(struct mpv_handle *client, const char *fname)
}
lua_State *L = ctx->state = luaL_newstate();
if (!L)
if (!L) {
MP_FATAL(ctx, "Could not initialize Lua.\n");
goto error_out;
}
if (mp_cpcall(L, run_lua, ctx)) {
const char *err = "unknown error";