From e6210007c72e39041d1ec3921809b7a6584aa2f9 Mon Sep 17 00:00:00 2001 From: NickAc <32451103+NickAcPT@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:06:30 +0100 Subject: [PATCH] Fix panic when overflow --- .../src/blockbench/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/nmsr-rendering-blockbench-model-generator-experiment/src/blockbench/mod.rs b/utils/nmsr-rendering-blockbench-model-generator-experiment/src/blockbench/mod.rs index 42aab9b..f3b3328 100644 --- a/utils/nmsr-rendering-blockbench-model-generator-experiment/src/blockbench/mod.rs +++ b/utils/nmsr-rendering-blockbench-model-generator-experiment/src/blockbench/mod.rs @@ -77,7 +77,7 @@ fn generate_outliner_groups( // Part groups is a vector of strings, each string being a group name - The last group name is the parent group let part_groups: Vec = part.get_group().to_vec(); - let parent_count = part_groups.len() - 1; + let parent_count = part_groups.len().saturating_sub(1); let mut rotation_stack = Vec::new();