From d02b12952dd43b6e46177508bb5268ea31c70d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 18 Sep 2019 09:15:33 +0800 Subject: Empty ticket list returns the list as NULL --- ticket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ticket.c b/ticket.c index 2751b37..6290dcb 100644 --- a/ticket.c +++ b/ticket.c @@ -21,6 +21,11 @@ static size_t search_callback(void *contents, size_t size, size_t nmemb line = strtok(NULL, "\n"); do { (*listptr)->length++; + if (!strcmp(line, "No matching results.")) { + free(*listptr); + *listptr = NULL; + return realsize; + } } while ((line = strtok(NULL, "\n"))); rtclient_ticketlist *ptr = realloc(*listptr, sizeof(*listptr) + (*listptr)->length * sizeof(char *)); -- cgit v1.2.3