aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/linkedlists.h
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-04 05:53:48 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-04 05:53:48 +0000
commit1ad6e500c4bcb297897ae8a1f90cfc3dc325c6cd (patch)
tree4f896ce49cdceef6b56518be0b36fbcdaf4e55f5 /include/asterisk/linkedlists.h
parent6fa10d395530f33a1e6ab4b4b07f232c1de3c5c3 (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/asterisk/linkedlists.h')
-rw-r--r--include/asterisk/linkedlists.h10
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)