diff options
Diffstat (limited to 'include/asterisk/linkedlists.h')
-rwxr-xr-x | include/asterisk/linkedlists.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 9f5f216fd..b4085d7b9 100755 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -306,11 +306,13 @@ struct { \ used to link entries of this list together. Removes the head entry from the list, and returns a pointer to it. The - forward-link pointer in the returned entry is \b not cleared. + forward-link pointer in the returned entry is \b not cleared. This macro + is safe to call on an empty list. */ #define AST_LIST_REMOVE_HEAD(head, field) ({ \ typeof((head)->first) cur = (head)->first; \ - (head)->first = (head)->first->field.next; \ + if (cur) \ + (head)->first = cur->field.next; \ cur; \ }) |