crash on start without selecting a timebar argument #26

Closed
opened 2024-09-05 11:26:21 +02:00 by cscherrNT · 1 comment
Collaborator
"name" = "crock"
"operating_system" = "Ubuntu 24.4.0 (noble) [64-bit]"
"crate_version" = "0.3.0"
"explanation" = """
Panic occurred in file '/home/cscherr/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crock-0.3.0/src/clock.rs' at line 211
"""
"cause" = "called `Option::unwrap()` on a `None` value"
"method" = "Panic"
"backtrace" = """

   0: 0x55bbace16a7c - core::panicking::panic::h6c780fb115b2371d
   1: 0x55bbace16939 - core::option::unwrap_failed::hff19eb16beb38f1f
   2: 0x55bbace2a77c - crock::clock::Clock::run::h562da7e74a0d40fe
   3: 0x55bbace21b8e - crock::main::h281a96c3bfe32cbc
   4: 0x55bbace19ed3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h16913b68c738695b
   5: 0x55bbace408ed - std::rt::lang_start::{{closure}}::h5c453ed34f0739ba
   6: 0x55bbacfe32bd - std::rt::lang_start_internal::hcee5ed89fc25829a
   7: 0x55bbace21f15 - main
   8: 0x7f81e576e1ca - __libc_start_call_main
                at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
   9: 0x7f81e576e28b - __libc_start_main_impl
                at ./csu/../csu/libc-start.c:360
  10: 0x55bbace171a5 - _start
  11:        0x0 - <unresolved>"""
```toml "name" = "crock" "operating_system" = "Ubuntu 24.4.0 (noble) [64-bit]" "crate_version" = "0.3.0" "explanation" = """ Panic occurred in file '/home/cscherr/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crock-0.3.0/src/clock.rs' at line 211 """ "cause" = "called `Option::unwrap()` on a `None` value" "method" = "Panic" "backtrace" = """ 0: 0x55bbace16a7c - core::panicking::panic::h6c780fb115b2371d 1: 0x55bbace16939 - core::option::unwrap_failed::hff19eb16beb38f1f 2: 0x55bbace2a77c - crock::clock::Clock::run::h562da7e74a0d40fe 3: 0x55bbace21b8e - crock::main::h281a96c3bfe32cbc 4: 0x55bbace19ed3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h16913b68c738695b 5: 0x55bbace408ed - std::rt::lang_start::{{closure}}::h5c453ed34f0739ba 6: 0x55bbacfe32bd - std::rt::lang_start_internal::hcee5ed89fc25829a 7: 0x55bbace21f15 - main 8: 0x7f81e576e1ca - __libc_start_call_main at ./csu/../sysdeps/nptl/libc_start_call_main.h:58 9: 0x7f81e576e28b - __libc_start_main_impl at ./csu/../csu/libc-start.c:360 10: 0x55bbace171a5 - _start 11: 0x0 - <unresolved>""" ```
cscherrNT added the
Kind/Bug
Priority
Critical
Reviewed
Confirmed
labels 2024-09-05 11:26:21 +02:00
cscherrNT changed title from crash on start to crash on start without selecting a timebar argument 2024-09-05 11:27:39 +02:00
Author
Collaborator

In crock.rs line 211, we call unwrap on self.timebar_len(). This can only work when a time bar was requested by the user with CLI options, so it panics if no options are selected.

        let tick_rate = std::time::Duration::from_millis(100);
        let mut last_tick = Instant::now();
        let mut uidata: Data = Data::new(self.timebar_len().unwrap()); // boom if no timebar is requested (default args)
        self.setup()?;
In `crock.rs` line 211, we call `unwrap` on `self.timebar_len()`. This can only work when a time bar was requested by the user with CLI options, so it panics if no options are selected. ```rs let tick_rate = std::time::Duration::from_millis(100); let mut last_tick = Instant::now(); let mut uidata: Data = Data::new(self.timebar_len().unwrap()); // boom if no timebar is requested (default args) self.setup()?; ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: PlexSheep/crock#26
No description provided.