diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-11-04 15:32:32 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-11-04 15:32:32 +0100 |
commit | 1a0472c5dd71888440b4a835a71b38d0b2b6c7ba (patch) | |
tree | 36d95af198d8e28be5ed8601240a82088e617d2f /src | |
parent | f8c8ee1600ed4dfa7b4695545ced8947e680a392 (diff) | |
download | weechat-1a0472c5dd71888440b4a835a71b38d0b2b6c7ba.zip |
Added check of buffer pointer in weechat_printf (plugins API)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-buffer.c | 4 | ||||
-rw-r--r-- | src/plugins/plugin-api.c | 3 |
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); |