From a56d65a7c0a81f4f26a6c3f545ab9b97e4e5b853 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 19 Apr 2006 12:35:30 +0000 Subject: [PATCH] Fixed crash after /upgrade if a line in history is empty --- ChangeLog | 3 ++- src/common/history.c | 6 ++++++ weechat/ChangeLog | 3 ++- weechat/src/common/history.c | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25aa0b171..cd776d80f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-04-15 +ChangeLog - 2006-04-19 Version 0.1.9 (under dev!): + * fixed crash after /upgrade if a line in history is empty * fixed many crashes with DCC chat * added new option to customize input prompt * added nick modes diff --git a/src/common/history.c b/src/common/history.c index db61276f7..eb889ab66 100644 --- a/src/common/history.c +++ b/src/common/history.c @@ -73,6 +73,9 @@ void history_buffer_add (void *buffer, char *string) { t_history *new_history, *ptr_history; + + if (!string) + return; if ( !((t_gui_buffer *)(buffer))->history || ( ((t_gui_buffer *)(buffer))->history @@ -121,6 +124,9 @@ history_global_add (char *string) { t_history *new_history, *ptr_history; + if (!string) + return; + if (!history_global || (history_global && ascii_strcasecmp (history_global->text, string) != 0)) diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 25aa0b171..cd776d80f 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,9 +1,10 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-04-15 +ChangeLog - 2006-04-19 Version 0.1.9 (under dev!): + * fixed crash after /upgrade if a line in history is empty * fixed many crashes with DCC chat * added new option to customize input prompt * added nick modes diff --git a/weechat/src/common/history.c b/weechat/src/common/history.c index db61276f7..eb889ab66 100644 --- a/weechat/src/common/history.c +++ b/weechat/src/common/history.c @@ -73,6 +73,9 @@ void history_buffer_add (void *buffer, char *string) { t_history *new_history, *ptr_history; + + if (!string) + return; if ( !((t_gui_buffer *)(buffer))->history || ( ((t_gui_buffer *)(buffer))->history @@ -121,6 +124,9 @@ history_global_add (char *string) { t_history *new_history, *ptr_history; + if (!string) + return; + if (!history_global || (history_global && ascii_strcasecmp (history_global->text, string) != 0))