diff options
author | Emmanuel Bouthenot <kolter@openics.org> | 2006-05-08 20:22:42 +0000 |
---|---|---|
committer | Emmanuel Bouthenot <kolter@openics.org> | 2006-05-08 20:22:42 +0000 |
commit | 5d08d5e27c1d2430ba25f6903d47d7acb422f144 (patch) | |
tree | 4271f8ddf6e123645c61e390d3f013aca7b6cc13 /src/plugins/scripts | |
parent | 93e69f5b3efec9ddc9198e7bb4d5f06af19bad28 (diff) | |
download | weechat-5d08d5e27c1d2430ba25f6903d47d7acb422f144.zip |
- fix a crash in ruby when a function return nothing (close bug #16552)
- add a warning when a function return nothing (python, ruby)
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 10 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby.c | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 4e50072a7..8f024fde4 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -91,14 +91,20 @@ weechat_python_exec (t_weechat_plugin *plugin, else rc = PyObject_CallFunction (evFunc, ""); + + if (rc == Py_None) + { + python_plugin->print_server (python_plugin, "Python error: function \"%s\" must return a valid value", function); + return PLUGIN_RC_OK; + } + if (rc) { ret = (int) PyInt_AsLong(rc); Py_XDECREF(rc); } - if (PyErr_Occurred ()) - PyErr_Print (); + if (PyErr_Occurred ()) PyErr_Print (); if (ret < 0) return PLUGIN_RC_OK; diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index 8a35cbf5a..6e0767f6b 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -153,6 +153,12 @@ weechat_ruby_exec (t_weechat_plugin *plugin, return PLUGIN_RC_KO; } + + if (ruby_retcode == Qnil) + { + ruby_plugin->print_server (ruby_plugin, "Ruby error: function \"%s\" must return a valid value", function); + return PLUGIN_RC_OK; + } return NUM2INT(ruby_retcode); } |