From 7b689398c7b59a52b42b39c265e2c7c5990fc41c Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 27 Jun 2026 14:32:54 -0600 Subject: [PATCH] fix(playlist): correct with_db result check in favorite toggle with_db flattens the inner Result to Option<()> (so callers can .unwrap_or_default()), so the favorite-revert guard must test ok.is_none() rather than matches!(ok, Some(Ok(()))). Caught by cargo check -p qbz; the whole bin now compiles clean. cc --- crates/qbz/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/qbz/src/main.rs b/crates/qbz/src/main.rs index 86f3af50f..551f39337 100644 --- a/crates/qbz/src/main.rs +++ b/crates/qbz/src/main.rs @@ -9072,10 +9072,13 @@ fn main() -> Result<(), Box> { w.global::().set_is_favorite(new_fav); let weak2 = weak.clone(); handle.spawn_blocking(move || { + // with_db flattens the inner Result to Option<()> + // (None = no db OR the write failed) -> revert the + // optimistic heart on failure. let ok = crate::library_db::with_db(|db| { db.set_playlist_favorite(pid_u64, new_fav) }); - if !matches!(ok, Some(Ok(()))) { + if ok.is_none() { log::error!("[qbz-slint] toggle playlist favorite failed"); let _ = weak2.upgrade_in_event_loop(move |w| { w.global::().set_is_favorite(was_fav);