From c658d229256f8e9d2da7b4b241bee4c9cd6b3914 Mon Sep 17 00:00:00 2001 From: NBonaparte <98007b33@opayq.com> Date: Sun, 20 Nov 2016 22:44:35 -0800 Subject: [PATCH] fix(token): more patches --- src/drawtypes/label.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/drawtypes/label.cpp b/src/drawtypes/label.cpp index 28799113..14722951 100644 --- a/src/drawtypes/label.cpp +++ b/src/drawtypes/label.cpp @@ -26,7 +26,7 @@ namespace drawtypes { } void label::replace_token(string token, string replacement) { - if (m_text.find(token) == string::npos) + if (m_text.find(token) == string::npos || m_token_iterator == m_token_bounds.end()) return; m_tokenized = string_util::replace_all_bounded(m_tokenized, token, replacement, @@ -77,13 +77,14 @@ namespace drawtypes { name = string_util::ltrim(string_util::rtrim(name, '>'), '<'); string text; - string line{text}; if (required) text = conf.get(section, name); else text = conf.get(section, name, def); + string line{text}; + while ((start = line.find('%')) != string::npos && (end = line.find('%', start + 1)) != string::npos) { auto token = line.substr(start, end);