CI testing: don't crash if screenshot manager resource is not available (#12385)

# Objective

- After #12370, ci testing with minimal plugins doesn't hang but it
crash as the resource `ScreenshotManager` doesn't exist

## Solution

- Check if the resource exists
This commit is contained in:
François 2024-03-09 00:38:56 +01:00 committed by GitHub
parent 7546624471
commit 8e467f4cad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,8 +3,9 @@
use bevy_app::{App, AppExit, Update};
use bevy_ecs::{
entity::Entity,
prelude::Resource,
prelude::{resource_exists, Resource},
query::With,
schedule::IntoSystemConfigs,
system::{Local, Query, Res, ResMut},
};
use bevy_render::view::screenshot::ScreenshotManager;
@ -67,8 +68,13 @@ pub(crate) fn setup_app(app: &mut App) -> &mut App {
)));
}
app.insert_resource(config)
.add_systems(Update, (ci_testing_exit_after, ci_testing_screenshot_at));
app.insert_resource(config).add_systems(
Update,
(
ci_testing_exit_after,
ci_testing_screenshot_at.run_if(resource_exists::<ScreenshotManager>),
),
);
app
}