From 77f016536fe30d8ffaab59ba2cbe780e7538f61d Mon Sep 17 00:00:00 2001 From: "Joshua J. Bouw" Date: Sun, 29 Nov 2020 12:04:36 +0700 Subject: [PATCH] Fix `RenderResources` index slicing --- crates/bevy_derive/src/render_resources.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_derive/src/render_resources.rs b/crates/bevy_derive/src/render_resources.rs index 2621522e4388d..2fb33944dda25 100644 --- a/crates/bevy_derive/src/render_resources.rs +++ b/crates/bevy_derive/src/render_resources.rs @@ -160,11 +160,11 @@ pub fn derive_render_resources(input: TokenStream) -> TokenStream { } fn get_render_resource_name(&self, index: usize) -> Option<&str> { - Some(#render_resource_names_ident[index]) + #render_resource_names_ident.get(index).copied() } fn get_render_resource_hints(&self, index: usize) -> Option<#bevy_render_path::renderer::RenderResourceHints> { - #render_resource_hints_ident[index].clone() + #render_resource_hints_ident.get(index).and_then(|o| *o) } fn iter(&self) -> #bevy_render_path::renderer::RenderResourceIterator {