fixed a bug with single word strings and multiple choice blocks side by side
This commit is contained in:
@@ -27,6 +27,12 @@ pub fn character_parse
|
||||
) -> Result<usize,(String,usize)>
|
||||
{
|
||||
let mut sum_index: usize = index;
|
||||
let characters_hashmap = characters.lock().unwrap_or_exit("Characters Mutex was poisoned",2);
|
||||
if character_name.to_lowercase() != "narrator" && ! characters_hashmap.contains_key(&character_name)
|
||||
{
|
||||
return Err((format!("Character {character_name} does not exist"),sum_index + 1));
|
||||
}
|
||||
drop(characters_hashmap);
|
||||
// Ensure the index is valid (the index is not beyond the vector)
|
||||
let keyword = tokenise::get_keyword_token(tokens, sum_index)
|
||||
.map_err(|err| (err, sum_index))?;
|
||||
|
||||
Reference in New Issue
Block a user