From 784ab635eed0daf395f58d27c41b359a9213e0dc Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 19 Nov 2015 00:17:18 +0000 Subject: [PATCH] Splitting an empty string now returns an empty vector --- src/string.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/string.cc b/src/string.cc index 22d4e609..693cf7d5 100644 --- a/src/string.cc +++ b/src/string.cc @@ -44,6 +44,9 @@ Vector split(StringView str, char separator, char escape) Vector split(StringView str, char separator) { Vector res; + if (str.empty()) + return res; + auto beg = str.begin(); for (auto it = beg; it != str.end(); ++it) {