1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 12:26:40 +02:00

lua: fix crash when a lua function doesn't return a value and a string was expected (closes #718)

This commit is contained in:
Sébastien Helleu
2016-04-23 14:33:04 +02:00
parent 51c3e0b9ec
commit 8a1650b26f
2 changed files with 15 additions and 1 deletions
+13 -1
View File
@@ -204,7 +204,19 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
{
if (ret_type == WEECHAT_SCRIPT_EXEC_STRING)
{
ret_value = strdup ((char *) lua_tostring (lua_current_interpreter, -1));
ret_value = (char *) lua_tostring (lua_current_interpreter, -1);
if (ret_value)
{
ret_value = strdup (ret_value);
}
else
{
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"%s\" must "
"return a valid value"),
weechat_prefix ("error"), LUA_PLUGIN_NAME,
function);
}
}
else if (ret_type == WEECHAT_SCRIPT_EXEC_INT)
{