diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-11-19 00:17:18 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-11-19 00:17:18 +0000 |
| commit | 784ab635eed0daf395f58d27c41b359a9213e0dc (patch) | |
| tree | edd816e450187c420693d9c4e4fa24777cc747c9 /src/string.cc | |
| parent | 9656f088e77ea05501539ce63b7420f13b287139 (diff) | |
Splitting an empty string now returns an empty vector
Diffstat (limited to 'src/string.cc')
| -rw-r--r-- | src/string.cc | 3 |
1 files changed, 3 insertions, 0 deletions
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<String> split(StringView str, char separator, char escape) Vector<StringView> split(StringView str, char separator) { Vector<StringView> res; + if (str.empty()) + return res; + auto beg = str.begin(); for (auto it = beg; it != str.end(); ++it) { |
