summaryrefslogtreecommitdiff
path: root/ticket.c
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-01 20:51:56 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-01 20:51:56 +0800
commit84207f6e0a54bdb8fb263ba4e0a90417e6352892 (patch)
tree4f267d0d2e5ede1237ed89635fbdd2a39c33782c /ticket.c
parent9c87e89acc77f59f5a110c6216fc9cab62011ff5 (diff)
Ticket history data member might be empty
Diffstat (limited to 'ticket.c')
-rw-r--r--ticket.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ticket.c b/ticket.c
index 4960969..821f982 100644
--- a/ticket.c
+++ b/ticket.c
@@ -145,9 +145,13 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb
ticket_history->new_value = NULL;
} else if (!strcmp(token, "Data")) {
token = strtok_r(NULL, ":", &tokensaveptr);
- ticket_history->data
- = malloc(strlen(token));
- strcpy(ticket_history->data, ++token);
+ if (token && strcmp(token, "")) {
+ ticket_history->data
+ = malloc(strlen(token));
+ strcpy(ticket_history->data
+ , ++token);
+ } else
+ ticket_history->data = NULL;
} else if (!strcmp(token, "Description")) {
token = strtok_r(NULL, ":", &tokensaveptr);
ticket_history->description