From: Mikko Rasa Date: Mon, 3 Jun 2019 11:59:04 +0000 (+0300) Subject: Fix check for appending pattern suffix X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6a166cffc39f3d2f447a9da932407eddbc51135a;p=builder.git Fix check for appending pattern suffix If the body is too short to already contain the suffix, it should be added. --- 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; }