Fix crash when printing a message without any buffer created

This commit is contained in:
Sebastien Helleu 2008-11-17 05:34:15 +01:00
parent 6615379daf
commit 4f43cba553

View File

@ -1079,6 +1079,8 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
/* call modifier for message printed ("weechat_print") */ /* call modifier for message printed ("weechat_print") */
new_msg = NULL; new_msg = NULL;
if (buffer)
{
length = strlen (plugin_get_name (buffer->plugin)) + 1 + length = strlen (plugin_get_name (buffer->plugin)) + 1 +
strlen (buffer->name) + 1 + ((tags) ? strlen (tags) : 0) + 1; strlen (buffer->name) + 1 + ((tags) ? strlen (tags) : 0) + 1;
modifier_data = malloc (length); modifier_data = malloc (length);
@ -1099,6 +1101,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
new_msg = NULL; new_msg = NULL;
} }
} }
}
/* message not dropped? */ /* message not dropped? */
if (!new_msg || new_msg[0]) if (!new_msg || new_msg[0])