Skip to content

Commit c404dad

Browse files
authored
Fix: Handle possible missing settings in atmosphere_insert (#77)
1 parent 0f6bb31 commit c404dad

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/plugin.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,17 @@ pub struct AtmosphereSkyBox;
105105
fn atmosphere_insert(
106106
mut commands: Commands,
107107
mut mesh_assets: ResMut<Assets<Mesh>>,
108-
settings: Res<AtmosphereSettings>,
108+
settings: Option<Res<AtmosphereSettings>>,
109109
material: Res<AtmosphereSkyBoxMaterial>,
110110
atmosphere_cameras: Query<(Entity, &Projection, &AtmosphereCamera), Added<AtmosphereCamera>>,
111111
) {
112+
let skybox_creation_mode = match settings {
113+
Some(settings) => settings.skybox_creation_mode,
114+
None => SkyboxCreationMode::default(),
115+
};
116+
112117
for (camera, projection, atmosphere_camera) in &atmosphere_cameras {
113-
let far_size = match settings.skybox_creation_mode {
118+
let far_size = match skybox_creation_mode {
114119
// TODO: Use `unwrap_or(fallback)` when `projection.far()` becomes an `Option<f32>`
115120
SkyboxCreationMode::FromProjectionFarWithFallback(_fallback) => projection.far(),
116121
SkyboxCreationMode::FromSpecifiedFar(specified) => specified,

0 commit comments

Comments
 (0)