From fa3fc59a5f10e2f3aafe94b9cdc96f756e6a44aa Mon Sep 17 00:00:00 2001 From: Azalea Gui <22280294+hykilpikonna@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:08:06 -0400 Subject: [PATCH] [F] Fix trying to get backend from non-existing backend --- crates/hyfetch/src/bin/hyfetch.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/hyfetch/src/bin/hyfetch.rs b/crates/hyfetch/src/bin/hyfetch.rs index eee6490f..fefe7a7c 100644 --- a/crates/hyfetch/src/bin/hyfetch.rs +++ b/crates/hyfetch/src/bin/hyfetch.rs @@ -247,7 +247,10 @@ fn create_config( }); debug!(?det_ansi, "detected color mode"); - let asc = get_distro_ascii(distro, backend).context("failed to get distro ascii")?; + // Try to get ascii from given backend first, if it fails, try neofetch backend + let asc = get_distro_ascii(distro, backend).or_else(|_| { + get_distro_ascii(distro, Backend::Neofetch).context("failed to get distro ascii from neofetch backend") + })?; let asc = asc.to_normalized().context("failed to normalize ascii")?; let theme = det_bg.map(|bg| bg.theme()).unwrap_or_default(); let color_mode = det_ansi.unwrap_or(AnsiMode::Ansi256);