fixed segfault

thanks to chneukirchen
This commit is contained in:
Sascha Kruse 2011-09-24 00:45:14 +02:00
parent f7109c9b19
commit 5a5211006e

10
dunst.c
View File

@ -183,14 +183,20 @@ int list_len(msg_queue_t *list) {
void void
check_timeouts(void) { check_timeouts(void) {
msg_queue_t *cur; msg_queue_t *cur, *next;
for(cur = msgqueue; cur != NULL; cur = cur->next) { cur = msgqueue;
while(cur != NULL) {
if(cur->start == 0 || cur->timeout == 0) { if(cur->start == 0 || cur->timeout == 0) {
cur = cur->next;
continue; continue;
} }
if(difftime(now, cur->start) > cur->timeout) { if(difftime(now, cur->start) > cur->timeout) {
next = cur->next;
delete_msg(cur); delete_msg(cur);
cur = next;
} else {
cur = cur->next;
} }
} }
} }