DevinR528 / rumatui

WIP Command line Matrix client using matrix-rust-sdk
Apache License 2.0
63 stars 5 forks source link

Panic entering message in Send box #7

Closed strct closed 4 years ago

strct commented 4 years ago

Panic when entering a character in the message box and no room is active (happend after loggin in on just created user on a conduit server)

https://github.com/DevinR528/rumatui/blob/4c408570338d54e9652dfb0017f29c386b13823c/src/widgets/message/msgs.rs#L459-L464

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/widgets/message/msgs.rs:462:58
stack backtrace:
0: backtrace::backtrace::libunwind::trace
    at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
    at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
    at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
    at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
    at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
    at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
    at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
    at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
    at src/libstd/panicking.rs:198
9: std::panicking::default_hook
    at src/libstd/panicking.rs:217
10: std::panicking::rust_panic_with_hook
    at src/libstd/panicking.rs:526
11: rust_begin_unwind
    at src/libstd/panicking.rs:437
12: core::panicking::panic_fmt
    at src/libcore/panicking.rs:85
13: core::panicking::panic
    at src/libcore/panicking.rs:50
14: rumatui::widgets::message::msgs::MessageWidget::add_char
15: rumatui::main::{{closure}}
16: std::thread::local::LocalKey<T>::with
17: tokio::runtime::enter::Enter::block_on
18: tokio::runtime::thread_pool::ThreadPool::block_on
19: tokio::runtime::context::enter
20: tokio::runtime::Runtime::block_on
21: rumatui::main
22: std::rt::lang_start::{{closure}}
23: std::rt::lang_start_internal::{{closure}}
    at src/libstd/rt.rs:52
24: std::panicking::try::do_call
    at src/libstd/panicking.rs:348
25: std::panicking::try
    at src/libstd/panicking.rs:325
26: std::panic::catch_unwind
    at src/libstd/panic.rs:394
27: std::rt::lang_start_internal
    at src/libstd/rt.rs:51
28: main
29: __libc_start_main
30: _start
strct commented 4 years ago

Added a 10s gif with the crash, just typed a character (e.g. c) into the Send box. crash

DevinR528 commented 4 years ago

Would not doing anything be acceptable, as in if there is no room selected the input would be ignored?

Thanks for the detailed issue I'm glad you got it working, out of curiosity and because of another issue how did you install it and what OS are you using?

DevinR528 commented 4 years ago

I created a PR if you want to check it out https://github.com/DevinR528/rumatui/pull/8

strct commented 4 years ago

Thanks for fixing it so quickly :). I'm using Ubuntu 20.04, (obs for recording and kdenlive to edit the video and convert to gif). I used cargo install --git https://github.com/DevinR528/rumatui to install it, but now I cloned the repository and run it with cargo run. I agree that doing nothing is okay when no room is selected.