StrBuf_NextToken: if the source is empty, flush the target.
[citadel.git] / libcitadel / lib / stringbuf.c
index 6d8f549d371d2e00aac73d2e945f004d6564d635..dfba39d7e13e904ffc202186139a53a90bdfc40f 100644 (file)
@@ -1502,6 +1502,8 @@ int StrBufExtract_NextToken(StrBuf *dest, const StrBuf *Source, const char **pSt
            (Source->BufUsed == 0)      ) 
        {
                *pStart = StrBufNOTNULL;
+               if (dest != NULL)
+                       FlushStrBuf(dest);
                return -1;
        }