mirror of
https://github.com/WCBROW01/zblock.git
synced 2025-12-12 04:28:07 -05:00
[main.c] Fix adding empty feeds
If there are no items in a feed, set the last_pubDate variable to 0 instead of dereferencing a null pointer (oops)
This commit is contained in:
3
main.c
3
main.c
@ -258,7 +258,8 @@ static void bot_command_add(struct discord *client, const struct discord_interac
|
|||||||
}
|
}
|
||||||
|
|
||||||
feed.title = mrss_feed->title;
|
feed.title = mrss_feed->title;
|
||||||
feed.last_pubDate = mrss_feed->item->pubDate;
|
// if there are no entries, set the last pubDate to zero.
|
||||||
|
feed.last_pubDate = mrss_feed->item ? mrss_feed->item->pubDate : 0;
|
||||||
|
|
||||||
zblock_feed_info_err insert_res = zblock_feed_info_insert(database_conn, &feed);
|
zblock_feed_info_err insert_res = zblock_feed_info_insert(database_conn, &feed);
|
||||||
if (insert_res) {
|
if (insert_res) {
|
||||||
|
|||||||
Reference in New Issue
Block a user