From 6a166cffc39f3d2f447a9da932407eddbc51135a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 3 Jun 2019 14:59:04 +0300 Subject: [PATCH] Fix check for appending pattern suffix If the body is too short to already contain the suffix, it should be added. --- source/pattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/pattern.cpp b/source/pattern.cpp index 51ca9c6..91929f6 100644 --- a/source/pattern.cpp +++ b/source/pattern.cpp @@ -17,7 +17,7 @@ string Pattern::apply(const string &body) const string result = body; if(body.compare(0, prefix.size(), prefix)) result = prefix+result; - if(body.size()>suffix.size() && body.compare(body.size()-suffix.size(), suffix.size(), suffix)) + if(body.size()<=suffix.size() || body.compare(body.size()-suffix.size(), suffix.size(), suffix)) result += suffix; return result; } -- 2.45.2