fix: don't crash if bookmarks.txt is missing

this was a one line fix that i just completely forgot about whilst improving the bookmarking system.
i feel very, very stupid.
This commit is contained in:
talwat 2025-09-25 19:15:41 +02:00
parent 05fe8069ea
commit 66f2243b2c
3 changed files with 4 additions and 3 deletions

2
Cargo.lock generated
View File

@ -1508,7 +1508,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "lowfi"
version = "1.7.1"
version = "1.7.2"
dependencies = [
"arc-swap",
"atomic_float",

View File

@ -1,6 +1,6 @@
[package]
name = "lowfi"
version = "1.7.1"
version = "1.7.2"
edition = "2021"
description = "An extremely simple lofi player."
license = "MIT"

View File

@ -39,9 +39,10 @@ impl Bookmarks {
Ok(data_dir.join("bookmarks.txt"))
}
/// Loads bookmarks from the `bookmarks.txt` file.
pub async fn load() -> eyre::Result<Self, BookmarkError> {
let text = fs::read_to_string(Self::path().await?).await?;
let text = fs::read_to_string(Self::path().await?).await.unwrap_or_default();
let lines: Vec<String> = text
.trim_start_matches("noheader")