summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/gui-buffer.c4
-rw-r--r--src/plugins/plugin-api.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 16afc0133..cb0051574 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -185,6 +185,10 @@ gui_buffer_valid (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
+ /* NULL buffer is valid (it's for printing on first buffer) */
+ if (!buffer)
+ return 1;
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 23b48a76c..6f0ec9e25 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -252,7 +252,8 @@ plugin_api_printf (struct t_weechat_plugin *plugin,
va_list argptr;
char buf[8192];
- if (!plugin || !format)
+ if (!plugin || !format
+ || !gui_buffer_valid ((struct t_gui_buffer *)buffer))
return;
va_start (argptr, format);