Skip to content

Option::unwrap panic in specialize_material2d_meshes #19048

@fatho

Description

@fatho

Bevy version

0.16

[Optional] Relevant system information

Does not seem relevant, but happy to provide extra info if needed.

What you did

Code worked fine on 0.15, but starts crashing on 0.16. I don't have a small reproducer readily available unfortunately, but I can potentially look into that at a later time if needed.

What went wrong

My application crashes on a unwrap call in specialize_material2d_meshes deep in the bevy internals.

thread 'Compute Task Pool (23)' panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_sprite-0.16.0/src/mesh2d/material.rs:730:79:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:692:5
   1: core::panicking::panic_fmt
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:145:5
   3: core::option::unwrap_failed
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/option.rs:2015:5
   4: core::option::Option<T>::unwrap
             at ~/.rustup/toolchains/1.85.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:978:21
   5: bevy_sprite::mesh2d::material::specialize_material2d_meshes
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_sprite-0.16.0/src/mesh2d/material.rs:730:79
   6: core::ops::function::FnMut::call_mut
             at ~/.rustup/toolchains/1.85.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
   7: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at ~/.rustup/toolchains/1.85.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
   8: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14) .> Out>>::run::call_inner
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/system/function_system.rs:945:21
   9: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14) .> Out>>::run
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/system/function_system.rs:948:17
  10: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/system/function_system.rs:735:19
  11: <bevy_ecs::system::schedule_system::InfallibleSystemWrapper<S> as bevy_ecs::system::system::System>::run_unsafe
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.16.0/src/system/schedule_system.rs:64:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_sprite::mesh2d::material::specialize_material2d_meshes<MyMaterial>`!

Additional information

I've seen #18980 so far, which seems to have an unwrap crash in the 3D variant of mesh material specialization, perhaps that's related?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorP-CrashA sudden unexpected crash

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions