mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +02:00
fix(dynamic string): crash when last segment is static and a single char
Resolves #117.
This commit is contained in:
parent
236bb09170
commit
2c88c99cb6
1 changed files with 6 additions and 2 deletions
|
@ -88,9 +88,13 @@ impl DynamicString {
|
|||
|
||||
let mut chars = input.chars().collect::<Vec<_>>();
|
||||
while !chars.is_empty() {
|
||||
let char_pair = &chars[..=1];
|
||||
let char_pair = if chars.len() > 1 {
|
||||
Some(&chars[..=1])
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let (token, skip) = if let ['{', '{'] = char_pair {
|
||||
let (token, skip) = if let Some(['{', '{']) = char_pair {
|
||||
const SKIP_BRACKETS: usize = 4; // two braces either side
|
||||
|
||||
let str = chars
|
||||
|
|
Loading…
Add table
Reference in a new issue