summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/python
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r--src/plugins/scripts/python/weechat-python.c10
1 files changed, 8 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;