Skip to content

onefetch_ascii: unicode chars causing panic #935

Closed
@ozwaldorf

Description

@ozwaldorf

Duplicates

  • I have searched the existing issues

Current behavior 😯

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/oz/.cargo/git/checkouts/onefetch-258c4293dfe669f3/1716519/ascii/src/lib.rs:216:22
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/core/src/panicking.rs:64:14
   2: core::panicking::panic
             at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/core/src/panicking.rs:114:5
   3: core::option::Option<T>::unwrap
             at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/core/src/option.rs:822:21
   4: onefetch_ascii::token
             at /home/oz/.cargo/git/checkouts/onefetch-258c4293dfe669f3/1716519/ascii/src/lib.rs:216:11
   5: onefetch_ascii::char_token
             at /home/oz/.cargo/git/checkouts/onefetch-258c4293dfe669f3/1716519/ascii/src/lib.rs:236:5
   6: <onefetch_ascii::Tokens as core::iter::traits::iterator::Iterator>::next::{{closure}}
             at /home/oz/.cargo/git/checkouts/onefetch-258c4293dfe669f3/1716519/ascii/src/lib.rs:98:25
   7: core::option::Option<T>::or_else
             at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/core/src/option.rs:1417:21
   8: <onefetch_ascii::Tokens as core::iter::traits::iterator::Iterator>::next
             at /home/oz/.cargo/git/checkouts/onefetch-258c4293dfe669f3/1716519/ascii/src/lib.rs:96:24
   9: <&mut I as core::iter::traits::iterator::Iterator>::next
             at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/core/src/iter/traits/iterator.rs:3888:9
  10: onefetch_ascii::Tokens::is_empty
             at /home/oz/.cargo/git/checkouts/onefetch-258c4293dfe669f3/1716519/ascii/src/lib.rs:107:22
  11: onefetch_ascii::AsciiArt::new
             at /home/oz/.cargo/git/checkouts/onefetch-258c4293dfe669f3/1716519/ascii/src/lib.rs:15:16
  12: libpunfetch::distros::Distro::ascii
             at ./src/distros/mod.rs:28:9
  13: libpunfetch::render::Renderer::render
             at ./src/render.rs:194:27
  14: punfetch::main
             at ./src/bin.rs:73:5
  15: core::ops::function::FnOnce::call_once
             at /rustc/cc47b069983292e4ee8982d5dabe6301452c5f25/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Expected behavior 🤔

Print the special characters!

Steps to reproduce 🕹

With a setup like this:

"Manjaro":
  colors:
    ansi:
      - green
    hex:
      - "#33aadd"
  ascii: |
    {0}██████████████████  ████████
    {0}██████████████████  ████████
    {0}██████████████████  ████████
    {0}██████████████████  ████████
    {0}████████            ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████
    {0}████████  ████████  ████████

Additional context/Screenshots 🔦

  • Integrating onefetch_ascii into punfetch

Possible Solution 💡

  • Add another token type to represent unicode chars

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions