evas filters: Fix minor issue with print

If the call to tostring() fails, replace the string by (invalid)
rather than ignore the error.

Fixes CID 1308612
This commit is contained in:
Jean-Philippe Andre 2016-08-09 11:19:11 +09:00
parent 4f98d6a007
commit d6817f4d6e
1 changed files with 7 additions and 2 deletions

View File

@ -2202,8 +2202,13 @@ _lua_print(lua_State *L)
lua_getglobal(L, _lua_errfunc_name);
lua_getglobal(L, "tostring"); //+1
lua_pushvalue(L, i); //+1
lua_pcall(L, 1, 1, -3); //-2/+1
str = lua_tostring(L, -1);
if (lua_pcall(L, 1, 1, -3) == 0) //-2/+1
str = lua_tostring(L, -1);
else
{
ERR("tostring() failed inside print(): %s", lua_tostring(L, -1));
str = "(invalid)";
}
eina_strbuf_append(s, str ? str : "(nil)");
lua_pop(L, 2);
eina_strbuf_append_char(s, ' ');