Skip to content

Commit

Permalink
Merge pull request #324 from cardigan1008/issue-format
Browse files Browse the repository at this point in the history
Fix token exceed in from_str()
  • Loading branch information
ChristopherRabotin authored Jul 28, 2024
2 parents 754a86e + 93192da commit 6af5c26
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/efmt/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ impl FromStr for Format {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut me = Format::default();
for token in s.split('%') {
if me.num_items == MAX_TOKENS && token.chars().next().is_some() {
return Err(ParsingError::UnknownFormat);
}
match token.chars().next() {
Some(char) => match char {
'Y' => {
Expand Down
Loading

0 comments on commit 6af5c26

Please sign in to comment.