Fix: Hyfetch panics on some distros that are not defined (#455)

This commit is contained in:
ObsoleteDev 2025-10-21 12:25:48 +01:00 committed by GitHub
parent ba88581ed4
commit de2141347e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -781,8 +781,11 @@ fn create_config(
// get distro string and convert it into the enum, neofetch friendly format, so we can check for small logos with the {distro}_small neofetch naming scheme.
let tmp_dst = get_distro_name(backend).or_else(|_| get_distro_name(Backend::Neofetch)).context("failed to get distro name")?;
let detected_dst = Some(distro.map_or_else(
|| format!("{:?}", Distro::detect(tmp_dst).unwrap()),
|d| d.to_string(),
|| {
Distro::detect(&tmp_dst)
.map_or("".to_string(), |d| format!("{:?}", d).to_lowercase())
},
|d| d.to_string().to_lowercase(),
));
// in case someone specified {distro}_small already in the --distro arg