1
0
Fork 0
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:
Jake Stanger 2023-04-22 16:29:54 +01:00
parent 236bb09170
commit 2c88c99cb6
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61

View file

@ -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