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