1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 04:46:37 +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
+2
View File
@@ -37,6 +37,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* irc: add option irc.network.sasl_fail_unavailable (issue #600, issue #697)
* irc: add multiple targets and support of "-server" in command /ctcp
(issue #204, issue #493)
* lua: fix crash when a lua function doesn't return a value and a string was
expected (issue #718)
* ruby: add detection of Ruby 2.3 (issue #698)
* trigger: add "recover" in default triggers cmd_pass/msg_auth, and "regain"
in default trigger "msg_auth" (issue #511)
+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)
{