Skip to content

Commit 46053e4

Browse files
committed
Make some RenderApp access in bevy_gizmos panic instead of doing nothing.
1 parent ac0dcef commit 46053e4

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

crates/bevy_gizmos/src/pipeline_2d.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ pub struct LineGizmo2dPlugin;
3535

3636
impl Plugin for LineGizmo2dPlugin {
3737
fn build(&self, app: &mut App) {
38-
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
39-
return;
40-
};
38+
let render_app = app
39+
.get_sub_app_mut(RenderApp)
40+
.expect("RenderPlugin has not been added");
4141

4242
render_app
4343
.add_render_command::<Transparent2d, DrawLineGizmo2d>()
@@ -63,9 +63,9 @@ impl Plugin for LineGizmo2dPlugin {
6363
}
6464

6565
fn finish(&self, app: &mut App) {
66-
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
67-
return;
68-
};
66+
let render_app = app
67+
.get_sub_app_mut(RenderApp)
68+
.expect("RenderPlugin has not been added");
6969

7070
render_app.init_resource::<LineGizmoPipeline>();
7171
render_app.init_resource::<LineJointGizmoPipeline>();

crates/bevy_gizmos/src/pipeline_3d.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ use tracing::error;
3838
pub struct LineGizmo3dPlugin;
3939
impl Plugin for LineGizmo3dPlugin {
4040
fn build(&self, app: &mut App) {
41-
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
42-
return;
43-
};
41+
let render_app = app
42+
.get_sub_app_mut(RenderApp)
43+
.expect("RenderPlugin has not been added");
4444

4545
render_app
4646
.add_render_command::<Transparent3d, DrawLineGizmo3d>()
@@ -61,9 +61,9 @@ impl Plugin for LineGizmo3dPlugin {
6161
}
6262

6363
fn finish(&self, app: &mut App) {
64-
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
65-
return;
66-
};
64+
let render_app = app
65+
.get_sub_app_mut(RenderApp)
66+
.expect("RenderPlugin has not been added");
6767

6868
render_app.init_resource::<LineGizmoPipeline>();
6969
render_app.init_resource::<LineJointGizmoPipeline>();

0 commit comments

Comments
 (0)