1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 19:34:24 +02:00

Merge pull request #118 from JakeStanger/fix/dynamic-string

fix(dynamic string): crash when last segment is static and a single char
This commit is contained in:
Jake Stanger 2023-04-22 16:40:33 +01:00 committed by GitHub
commit 74d18aedfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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