diff --git a/CHANGELOG.md b/CHANGELOG.md index beac8900c..540ea5591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ - python: fix crash on quit with Python 3.12 ([#2046](https://github.com/weechat/weechat/issues/2046), [#2126](https://github.com/weechat/weechat/issues/2126)) - core: fix crash when deleting a bar that has no items ([#2138](https://github.com/weechat/weechat/issues/2138)) +- relay/api: fix crash when sending data to a remote buffer when the remote has been deleted ([#2157](https://github.com/weechat/weechat/issues/2157)) - irc, xfer: fix display of input prompt in IRC private buffers and DCC chat buffers ([#2128](https://github.com/weechat/weechat/issues/2128)) - core: apply buffer properties (options weechat.buffer.*) when a buffer name is changed - irc: fix property "short_name" of channel buffer when the joined channel has a different case than the `/join` command diff --git a/src/plugins/relay/api/remote/relay-remote-event.c b/src/plugins/relay/api/remote/relay-remote-event.c index c637b3287..a01c2e5f7 100644 --- a/src/plugins/relay/api/remote/relay-remote-event.c +++ b/src/plugins/relay/api/remote/relay-remote-event.c @@ -623,14 +623,17 @@ relay_remote_event_buffer_input_cb (const void *pointer, struct t_gui_buffer *buffer, const char *input_data) { - struct t_relay_remote *remote; + struct t_relay_remote *ptr_remote; cJSON *json, *json_body; long long buffer_id; /* make C compiler happy */ + (void) pointer; (void) data; - remote = (struct t_relay_remote *)pointer; + ptr_remote = relay_remote_search (weechat_buffer_get_string (buffer, "localvar_relay_remote")); + if (!ptr_remote) + return WEECHAT_RC_OK; json = NULL; @@ -654,7 +657,7 @@ relay_remote_event_buffer_input_cb (const void *pointer, cJSON_CreateString (input_data)); cJSON_AddItemToObject (json, "body", json_body); - relay_remote_network_send_json (remote, json); + relay_remote_network_send_json (ptr_remote, json); cJSON_Delete (json); @@ -822,7 +825,7 @@ RELAY_REMOTE_EVENT_CALLBACK(buffer) { ptr_buffer = weechat_buffer_new_props ( full_name, buffer_props, - &relay_remote_event_buffer_input_cb, event->remote, NULL, + &relay_remote_event_buffer_input_cb, NULL, NULL, NULL, NULL, NULL); apply_props = 0; }