From 26d9da920f30b20948ec0762a3cb8a159f271cb9 Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Wed, 2 Oct 2024 07:09:28 +0800 Subject: [PATCH] safeguard against panic --- src/to_kana.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/to_kana.rs b/src/to_kana.rs index c3f32d9..a20e695 100644 --- a/src/to_kana.rs +++ b/src/to_kana.rs @@ -29,7 +29,7 @@ pub fn to_kana_with_opt(input: &str, options: Options) -> String { }; // nothing found, pass through - if result.1 == 0 { + if result.1 == 0 || result.0.is_none() { ouput.push(chars[curr_pos]); curr_pos += 1; } else {