From 5a09ab51871a302a2d68533d7e086dfe86d9eb11 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 24 Apr 2013 12:29:47 +0000 Subject: [PATCH] --- src/ttrss.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ttrss.c b/src/ttrss.c index 3649b07..f955cee 100644 --- a/src/ttrss.c +++ b/src/ttrss.c @@ -65,6 +65,11 @@ static void **list_add(void **list, void *item) return result; } +struct headline ** +headlines_add(struct headline **list, struct headline *h) +{ + return (struct headline **)list_add((void **)list, (void *)h); +} struct headline *feed_get_headline(struct feed *feed, int id) { @@ -285,18 +290,24 @@ int ws_update_headlines(struct feed *feed) h->id = hid; h->excerpt = NULL; h->content = NULL; + h->title = NULL; + h->url = NULL; - tmp = (struct headline **)list_add((void **)feed->headlines, h); + tmp = headlines_add(feed->headlines, h); if (feed->headlines) free(feed->headlines); feed->headlines = tmp; } - j = json_object_object_get(jheadline, "title"); - h->title = strdup(json_object_get_string(j)); + if (!h->title) { + j = json_object_object_get(jheadline, "title"); + h->title = strdup(json_object_get_string(j)); + } - j = json_object_object_get(jheadline, "link"); - h->url = strdup(json_object_get_string(j)); + if (!h->url) { + j = json_object_object_get(jheadline, "link"); + h->url = strdup(json_object_get_string(j)); + } j = json_object_object_get(jheadline, "unread"); h->unread = json_object_get_boolean(j); -- 2.7.4