Skip to content

Commit

Permalink
Merge pull request #1933 from H3rnand3zzz/fix/wrong-encoding-error-fl…
Browse files Browse the repository at this point in the history
…ood-python-plugins

Improve string convertion error handling
  • Loading branch information
jubalh committed Nov 22, 2023
2 parents dc8776e + db96d13 commit 9ef05f4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/plugins/python_plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ python_pre_chat_message_display_hook(ProfPlugin* plugin, const char* const barej
{
disable_python_threads();
PyObject* p_args = Py_BuildValue("sss", barejid, resource, message);
if (!p_args) {
log_warning("Unable to convert strings in `python_pre_chat_message_display_hook` to 'UTF8'. barejid: %s, resource: %s, message: %s", barejid, resource, message);
allow_python_threads();
return NULL;
}
PyObject* p_function;

PyObject* p_module = plugin->module;
Expand Down Expand Up @@ -408,6 +413,12 @@ python_pre_room_message_display_hook(ProfPlugin* plugin, const char* const barej
{
disable_python_threads();
PyObject* p_args = Py_BuildValue("sss", barejid, nick, message);
if (!p_args) {
log_warning("Unable to convert strings in `python_pre_room_message_display_hook` to 'UTF8'. barejid: %s, nick: %s, message: %s", barejid, nick, message);
allow_python_threads();
return NULL;
}

PyObject* p_function;

PyObject* p_module = plugin->module;
Expand Down

0 comments on commit 9ef05f4

Please sign in to comment.