Skip to content

Commit

Permalink
Don't panic when attempting to set shader defs from an asset that has…
Browse files Browse the repository at this point in the history
…n't loaded yet (#1035)

Don't panic when attempting to set shader defs from an asset that hasn't loaded yet
  • Loading branch information
ColdIce1605 authored Dec 10, 2020
1 parent 7ab0eee commit 4a5bccc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions crates/bevy_render/src/shader/shader_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ pub fn asset_shader_defs_system<T: Asset>(
T: ShaderDefs + Send + Sync + 'static,
{
for (asset_handle, mut render_pipelines) in query.iter_mut() {
let shader_defs = assets.get(asset_handle).unwrap();
for shader_def in shader_defs.iter_shader_defs() {
for render_pipeline in render_pipelines.pipelines.iter_mut() {
render_pipeline
.specialization
.shader_specialization
.shader_defs
.insert(shader_def.to_string());
if let Some(asset_handle) = assets.get(asset_handle) {
let shader_defs = asset_handle;
for shader_def in shader_defs.iter_shader_defs() {
for render_pipeline in render_pipelines.pipelines.iter_mut() {
render_pipeline
.specialization
.shader_specialization
.shader_defs
.insert(shader_def.to_string());
}
}
}
}
Expand Down

0 comments on commit 4a5bccc

Please sign in to comment.