]> git.notmuchmail.org Git - notmuch/blobdiff - lib/tags.c
notmuch_tags_advance: Make safe against excessive calls.
[notmuch] / lib / tags.c
index afc132c50e17c2f41cb6f6709e3c6d827d237b95..85507e91fc35da13b52b1b82b2bcbe2a71af8f83 100644 (file)
@@ -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;
 }