diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-04 05:53:48 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-04 05:53:48 +0000 |
commit | 1ad6e500c4bcb297897ae8a1f90cfc3dc325c6cd (patch) | |
tree | 4f896ce49cdceef6b56518be0b36fbcdaf4e55f5 /include | |
parent | 6fa10d395530f33a1e6ab4b4b07f232c1de3c5c3 (diff) |
Does nobody know how to write a linked list properly? I mean seriously!
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@17183 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/linkedlists.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 610f8085b..8bff72e3f 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -478,11 +478,13 @@ struct { \ (head)->last = NULL; \ } else { \ typeof(elm) curelm = (head)->first; \ - while (curelm->field.next != (elm)) \ + while (curelm && (curelm->field.next != (elm))) \ curelm = curelm->field.next; \ - curelm->field.next = (elm)->field.next; \ - if ((head)->last == (elm)) \ - (head)->last = curelm; \ + if (curelm) { \ + curelm->field.next = (elm)->field.next; \ + if ((head)->last == (elm)) \ + (head)->last = curelm; \ + } \ } \ } while (0) |