fix: error when atom omits an entry

This commit is contained in:
2026-02-15 11:38:02 +01:00
parent 4cad06e456
commit bad80ba1d3
4 changed files with 5 additions and 5 deletions
Generated
+1 -1
View File
@@ -962,7 +962,7 @@ dependencies = [
[[package]] [[package]]
name = "rss_library" name = "rss_library"
version = "0.3.2" version = "0.3.3"
dependencies = [ dependencies = [
"atom_syndication", "atom_syndication",
"reqwest", "reqwest",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "rss_library" name = "rss_library"
version = "0.3.2" version = "0.3.3"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
+2 -2
View File
@@ -1,5 +1,5 @@
use std::error::Error;
use atom_syndication::{Entry, Feed}; use atom_syndication::{Entry, Feed};
use std::error::Error;
pub async fn get_content(source: &str) -> Result<Feed, Box<dyn Error>> { pub async fn get_content(source: &str) -> Result<Feed, Box<dyn Error>> {
let content = reqwest::get(source).await?; let content = reqwest::get(source).await?;
@@ -20,7 +20,7 @@ pub fn get_new<'a>(feed: &'a Feed, latest: &str) -> &'a [Entry] {
.position(|entry| entry.id() == latest) .position(|entry| entry.id() == latest)
.map(|i| &feed.entries()[0..i]) .map(|i| &feed.entries()[0..i])
{ {
None => feed.entries(), None => &[],
Some(list) => list, Some(list) => list,
} }
} }
+1 -1
View File
@@ -1,3 +1,3 @@
pub mod atom;
pub mod discord; pub mod discord;
pub mod rss; pub mod rss;
pub mod atom;