Skip to content

Any keyboard action crashes the app on latest Rust #214

@rexim

Description

@rexim

Steps to reproduce

  • Setup the latest Rust (nightly or stable) in default.nix
  • $ nix-shell
  • $ cargo build
  • $ cargo run <ports...>
  • Focus on the app window
  • Press any key

Observed behaviour

The app crashed with the following error:

Listening on: 3 Launchkey Mini MIDI 1
Sending recorded events: 7 Synth input port (18189:0)
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20
note: Run with `RUST_BACKTRACE=1` for a backtrace.

The stracktrace with RUST_BACKTRACE=1


Listening on: 3 Launchkey Mini MIDI 1
Sending recorded events: 7 Synth input port (18189:0)
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic_new
   6: std::panicking::begin_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::panicking::panic
  10: <core::option::Option<T>>::unwrap
             at /checkout/src/libcore/macros.rs:22
  11: sdl2::event::Event::from_ll
             at /home/rexim/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.21.0/src/sdl2/event.rs:799
  12: sdl2::event::poll_event
             at /home/rexim/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.21.0/src/sdl2/event.rs:1173
  13: <sdl2::event::EventPollIterator<'a> as core::iter::iterator::Iterator>::next
             at /home/rexim/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.21.0/src/sdl2/event.rs:1294
  14: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
             at /checkout/src/liballoc/vec.rs:1782
  15: <alloc::vec::Vec<T> as core::iter::traits::FromIterator<T>>::from_iter
             at /checkout/src/liballoc/vec.rs:1695
  16: core::iter::iterator::Iterator::collect
             at /checkout/src/libcore/iter/iterator.rs:1303
  17: dimooper::screen::event_loop::EventLoop::run
             at src/screen/event_loop.rs:41
  18: dimooper::main
             at src/main.rs:105
  19: __rust_maybe_catch_panic
  20: std::rt::lang_start
  21: main
  22: __libc_start_main
  23: _start
             at ../sysdeps/x86_64/start.S:120

Expected behaviour

Application doesn't crash and continues to work correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions