aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--func.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/func.cc b/func.cc
index 2713fbe..e38e0e7 100644
--- a/func.cc
+++ b/func.cc
@@ -283,9 +283,10 @@ void WordsFunc(const vector<Value*>& args, Evaluator* ev, string* s) {
void FirstwordFunc(const vector<Value*>& args, Evaluator* ev, string* s) {
const string&& text = args[0]->Eval(ev);
- for (StringPiece tok : WordScanner(text)) {
- AppendString(tok, s);
- return;
+ WordScanner ws(text);
+ auto begin = ws.begin();
+ if (begin != ws.end()) {
+ AppendString(*begin, s);
}
}