diff options
author | wm4 <wm4@nowhere> | 2014-10-25 17:20:25 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-25 17:20:25 +0200 |
commit | 5b91f8985210b2203c4feba1092804eea65da500 (patch) | |
tree | 392e17c2291b951cc1c437f5b1583482370ed7f2 /player/lua.c | |
parent | a10321835e23e2f4df495c73aacb3156793de6cd (diff) | |
download | mpv-5b91f8985210b2203c4feba1092804eea65da500.tar.bz2 mpv-5b91f8985210b2203c4feba1092804eea65da500.tar.xz |
lua: fix some more lua_tostring() mistakes
Why can't it just raise an error?
Diffstat (limited to 'player/lua.c')
-rw-r--r-- | player/lua.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/player/lua.c b/player/lua.c index 80d40e1b6a..561ba37487 100644 --- a/player/lua.c +++ b/player/lua.c @@ -161,7 +161,7 @@ static int error_handler(lua_State *L) if (luaL_loadstring(L, "return debug.traceback('', 3)") == 0) { // e fn|err lua_call(L, 0, 1); // e backtrace const char *tr = lua_tostring(L, -1); - MP_WARN(ctx, "%s\n", tr); + MP_WARN(ctx, "%s\n", tr ? tr : "(unknown)"); } lua_pop(L, 1); // e @@ -1201,6 +1201,8 @@ static int script_subprocess(lua_State *L) lua_pushinteger(L, n + 1); // args n lua_gettable(L, -2); // args arg args[n] = talloc_strdup(tmp, lua_tostring(L, -1)); + if (!args[n]) + luaL_error(L, "program arguments must be strings"); lua_pop(L, 1); // args } args[num_args] = NULL; |