parser : guarde contre un unwrap interdit dans parse_quote

This commit is contained in:
Ahurac 2024-04-15 13:14:07 +02:00
parent cf1d6ff998
commit ed6aa02ce4

View file

@ -3,11 +3,14 @@ use crate::command::command_sequence::CommandSequence;
fn parse_quote(characters: &mut Vec<char>) -> String {
let mut quoted = String::default();
let mut current_char = characters.pop().unwrap();
while !characters.is_empty() && current_char != '\'' {
quoted.push(current_char);
current_char = characters.pop().unwrap();
if !characters.is_empty() {
let mut current_char = characters.pop().unwrap();
while !characters.is_empty() && current_char != '\'' {
quoted.push(current_char);
current_char = characters.pop().unwrap();
}
}
quoted