FaisalBinAhmed / MVGFahrinfo

Get up-to-date departure times for Munich public transport in your terminal.
https://crates.io/crates/mvgfahrinfo
MIT License
77 stars 4 forks source link

Thread panic after entering any character after Umlaut #8

Closed filvuk closed 8 months ago

filvuk commented 11 months ago

Trying to enter any character after typing any Umlaut (ä, ö, ü), as in e.g. "München", crashes the app. Inserting umlauts in-between already typed characters seems to work, but it does weird things with the cursor position (it can be moved further to the right than the word should actually allow).

FaisalBinAhmed commented 11 months ago

Hi, thanks for opening this. Do you have a screenshot of the panic message? That'd really help :) @filvuk

filvuk commented 11 months ago

Hi, sure. Here is the output:

fetching stations... thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/string.rs:1532:9 stack backtrace: 0: rust_begin_unwind at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:593:5 1: core::panicking::panic_fmt at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:67:14 2: core::panicking::panic at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:117:5 3: alloc::string::String::insert at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/string.rs:1532:9 4: mvgfahrinfo::app::App::enter_char at ./src/app.rs:141:9 5: mvgfahrinfo::update::update::{{closure}} at ./src/update.rs:56:17 6: mvgfahrinfo::main::{{closure}} at ./src/main.rs:52:66 7: tokio::runtime::park::CachedParkThread::block_on::{{closure}} at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/park.rs:282:63 8: tokio::runtime::coop::with_budget at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/coop.rs:107:5 9: tokio::runtime::coop::budget at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/coop.rs:73:5 10: tokio::runtime::park::CachedParkThread::block_on at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/park.rs:282:31 11: tokio::runtime::context::blocking::BlockingRegionGuard::block_on at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/context/blocking.rs:66:9 12: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}} at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/scheduler/multi_thread/mod.rs:87:13 13: tokio::runtime::context::runtime::enter_runtime at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/context/runtime.rs:65:16 14: tokio::runtime::scheduler::multi_thread::MultiThread::block_on at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/scheduler/multi_thread/mod.rs:86:9 15: tokio::runtime::runtime::Runtime::block_on at /home/filip/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/runtime.rs:350:45 16: mvgfahrinfo::main at ./src/main.rs:57:5 17: core::ops::function::FnOnce::call_once at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

If you need the full backtrace, let me know.

FaisalBinAhmed commented 11 months ago

Thanks. I think I know what the problem is.

FaisalBinAhmed commented 11 months ago

I fixed the panic in https://github.com/FaisalBinAhmed/MVGFahrinfo/pull/10 it's a workaround ann currently the app ignores non-ascii characters. In the future, the app will support them or atleast parse them to 1 byte character but until then, the app should be running fine. @filvuk