Mercurial > geeqie
changeset 718:7119e30971ec
Fix a segfault occuring when logging an empty message and there is no log window.
author | zas_ |
---|---|
date | Wed, 21 May 2008 08:53:51 +0000 |
parents | aae956e84de4 |
children | ab4162fa9209 |
files | src/logwindow.c |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/logwindow.c Wed May 21 00:42:14 2008 +0000 +++ b/src/logwindow.c Wed May 21 08:53:51 2008 +0000 @@ -211,24 +211,25 @@ gint line_limit = 1000; //FIXME: option static GList *memory = NULL; - if (logwindow == NULL && *str) + if (logwindow == NULL) { - LogMsg *msg = g_new(LogMsg, 1); + if (*str) { + LogMsg *msg = g_new(LogMsg, 1); - msg->text = g_strdup(str); - msg->type = type; + msg->text = g_strdup(str); + msg->type = type; - memory = g_list_prepend(memory, msg); + memory = g_list_prepend(memory, msg); - while (g_list_length(memory) >= line_limit) - { - GList *work = g_list_last(memory); - LogMsg *oldest_msg = work->data; + while (g_list_length(memory) >= line_limit) + { + GList *work = g_list_last(memory); + LogMsg *oldest_msg = work->data; - g_free(oldest_msg->text); - memory = g_list_delete_link(memory, work); + g_free(oldest_msg->text); + memory = g_list_delete_link(memory, work); + } } - return; }