From 30d98ecfb65ce421ad3a1c24abd18b47495ef93f Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 18 Jun 2008 02:28:11 +0000 Subject: [PATCH] If an RSS feed contains an item with a missing title, don't crash citserver when saving the item. --- citadel/modules/rssclient/serv_rssclient.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 141ff69ed..eeaf361a4 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -141,13 +141,15 @@ void rss_save_item(struct rss_item *ri) { msg->cm_format_type = FMT_RFC822; msg->cm_fields['A'] = strdup("rss"); msg->cm_fields['N'] = strdup(NODENAME); - msg->cm_fields['U'] = html_to_ascii(ri->title, - strlen(ri->title), - 512, 0); + if (ri->title != NULL) { + msg->cm_fields['U'] = html_to_ascii(ri->title, strlen(ri->title), 512, 0); + } msg->cm_fields['T'] = malloc(64); snprintf(msg->cm_fields['T'], 64, "%ld", ri->pubdate); - if (!IsEmptyStr(ri->channel_title)) { - msg->cm_fields['O'] = strdup(ri->channel_title); + if (ri->channel_title != NULL) { + if (!IsEmptyStr(ri->channel_title)) { + msg->cm_fields['O'] = strdup(ri->channel_title); + } } msglen = 1024 + strlen(ri->link) + strlen(ri->description) ; -- 2.39.2