Skip to content

Hyfetch panics upon entering invalid alignment option after roll #460

@danameisnothing

Description

@danameisnothing

Describe the bug

When one enters the "roll" choice on the 5th step (color arrangement) of the configuration, and proceeds to choose the options on the "Your choice?" prompt whose ASCII art is not displayed, the program panics.

  • Does this issue still occur in the master branch? (Required)

Expected behavior

The options not displayed by the ASCII art should be hidden and not be selectable.

Screenshots

Screenshot of system specs as shown by hyfetch working normally:
Image
Screenshot of when the bug occured:
Image

Config file

Content of ~/.config/hyfetch.json (not present at the time of crash):

{
    "preset": "cisgender",
    "mode": "rgb",
    "auto_detect_light_dark": true,
    "light_dark": "dark",
    "lightness": 0.53,
    "color_align": {
        "mode": "horizontal"
    },
    "backend": "fastfetch",
    "args": null,
    "distro": null,
    "pride_month_disable": false,
    "custom_ascii_path": null
}

Additional context

Tested on Kubuntu 25.10, installed via cargo, v2.0.4
Error with RUST_BACKTRACE=1:

thread 'main' (14426) panicked at /home/testnow720/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/hyfetch-2.0.4/src/bin/hyfetch.rs:950:14:
selected color alignment should be valid
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: hyfetch::create_config
   4: hyfetch::main

This bug only seems to happen with a select few distro logos, where the "roll" option appears, such as Kubuntu, Lubuntu, Xubuntu, Mint, and Bazzite. Distro logos which don't have a "roll" option, such as Ubuntu, Manjaro and Arch, are not affected by this bug.
There is an expect() about "selected color alignment should be valid" in the code, so I'm not sure if this behaviour is already accounted for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions