Skip to content

Commit

Permalink
Fix possible out of bounds index in render_range
Browse files Browse the repository at this point in the history
  • Loading branch information
james-j-obrien committed Jul 22, 2023
1 parent 36b1646 commit d52344e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/bevy_render/src/render_phase/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ impl<I: PhaseItem> RenderPhase<I> {
let mut draw_functions = draw_functions.write();
draw_functions.prepare(world);

let mut index = range.start;
while index < range.end {
let item = &self.items[index];
let items = self.items.get(range).expect("`Range` provided to `render_range()` is out of bounds");
let mut index = 0;
while index < items.len() {
let item = &items[index];
let draw_function = draw_functions.get_mut(item.draw_function()).unwrap();
draw_function.draw(world, render_pass, view, item);
index += item.batch_size();
Expand Down

0 comments on commit d52344e

Please sign in to comment.