mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 15:21:41 +01:00
notmuch_tags_advance: Make safe against excessive calls.
Previously, an excess call would have caused a crash. Now it simply does nothing. Also, make notmuch_tags_get use a similar, consistent early return for a NULL iterator.
This commit is contained in:
parent
322fe4f3fb
commit
c979fc5b05
1 changed files with 6 additions and 3 deletions
|
@ -97,15 +97,18 @@ notmuch_tags_has_more (notmuch_tags_t *tags)
|
|||
const char *
|
||||
notmuch_tags_get (notmuch_tags_t *tags)
|
||||
{
|
||||
if (tags->iterator)
|
||||
return (char *) tags->iterator->data;
|
||||
else
|
||||
if (tags->iterator == NULL)
|
||||
return NULL;
|
||||
|
||||
return (char *) tags->iterator->data;
|
||||
}
|
||||
|
||||
void
|
||||
notmuch_tags_advance (notmuch_tags_t *tags)
|
||||
{
|
||||
if (tags->iterator == NULL)
|
||||
return;
|
||||
|
||||
tags->iterator = tags->iterator->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue