From 6d45309e4ec668ee85f209dc36d8d1764ddd906d Mon Sep 17 00:00:00 2001 From: Yosshi999 Date: Sun, 17 Nov 2024 17:35:40 +0900 Subject: [PATCH] early return in render --- crates/voicevox_core/src/synthesizer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/voicevox_core/src/synthesizer.rs b/crates/voicevox_core/src/synthesizer.rs index 73b4a6696..299c2dbc0 100644 --- a/crates/voicevox_core/src/synthesizer.rs +++ b/crates/voicevox_core/src/synthesizer.rs @@ -470,6 +470,10 @@ mod inner { end: usize, ) -> Result> { // TODO: 44.1kHzなどの対応 + if (start..end).is_empty() { + // 指定区間が空のときは早期リターン + return Ok(vec![]); + } let spec_segment = crop_with_margin(audio, start..end); let wave_with_margin = self .render_audio_segment(spec_segment.to_owned(), audio.style_id)