diff options
| author | Strubbelkopp <[email protected]> | 2025-07-25 12:47:52 +0200 |
|---|---|---|
| committer | Strubbelkopp <[email protected]> | 2025-07-25 12:47:52 +0200 |
| commit | feb0a2076c57e0a8392c41f1cc5667e43c3073e7 (patch) | |
| tree | 3af8883387839911947a3155d15cfd8f3b83bc82 /src/mikuart.rs | |
| parent | 5b237c7e915fe0617507ea6dca74d46b4c401195 (diff) | |
| download | mikusays-c-feb0a2076c57e0a8392c41f1cc5667e43c3073e7.tar.gz mikusays-c-feb0a2076c57e0a8392c41f1cc5667e43c3073e7.zip | |
Ensure manually selected style doesn't exceed the maximum
Diffstat (limited to 'src/mikuart.rs')
| -rw-r--r-- | src/mikuart.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mikuart.rs b/src/mikuart.rs index 6d7b5c9..4197c60 100644 --- a/src/mikuart.rs +++ b/src/mikuart.rs @@ -504,6 +504,9 @@ pub fn get_miku_art(style: i32) -> Vec<&'static str> { ], ]; + if style > 0 && style as usize >= styles.len() { + panic!("Style {} does not exist! Chooese one below {}", style, styles.len()); + } let selected_style = if style < 0 { rng.random_range(0..styles.len()) } else { style as usize }; styles[selected_style].clone() } |
