bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.65k stars 3.52k forks source link

`gamepad_viewer` example broken when a controller is connected #15832

Open NiseVoid opened 2 hours ago

NiseVoid commented 2 hours ago

Bevy version

11d1ebeed

Relevant system information

What you did

With a controller connected run:

cargo run --example gamepad_viewer

When no controller is connected it starts correctly. When multiple controllers are detected it also crashes.

What went wrong

The app immediately exited

Additional information

The console output:

2024-10-10T18:35:28.259319Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-10-10T18:35:28.270366Z  INFO bevy_input::gamepad: Gamepad 5v1#4294967301 connected.
thread 'Compute Task Pool (15)' panicked at ./crates/bevy_text/src/text_access.rs:278:43:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
   2: core::panicking::panic
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:148:5
   3: core::option::unwrap_failed
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:2020:5
   4: core::option::Option<T>::unwrap
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:970:21
   5: bevy_text::text_access::TextWriter<R>::text
             at ./crates/bevy_text/src/text_access.rs:278:9
   6: gamepad_viewer::update_connected
             at ./examples/tools/gamepad_viewer.rs:468:6
   7: core::ops::function::FnMut::call_mut
alice-i-cecile commented 2 hours ago

Figuring out when this happened would be nice, but I'm strongly guessing #12770 is responsible.

rparrett commented 1 hour ago

Pretty sure this is just a mistake migrating the example for the text rework, but I don't have a gamepad to test just this moment.