[F] Fix trying to get backend from non-existing backend

This commit is contained in:
Azalea Gui 2025-08-21 10:08:06 -04:00
parent afa3c1dfb9
commit fa3fc59a5f

View file

@ -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);