diff options
| author | ilotterytea <iltsu@alright.party> | 2024-05-02 02:06:10 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-05-02 02:06:10 +0500 |
| commit | 645c58e5145027be710ebbec4c4a4a5530f4d1f6 (patch) | |
| tree | 79e5f89b1821b27ff59ac71731950800f0bf732f /src | |
| parent | 42e4bf7bb1104dffa46ae5bcb102e4ced69d6bbf (diff) | |
upd: return empty string if vec is empty
Diffstat (limited to 'src')
| -rw-r--r-- | src/utils/string.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils/string.cpp b/src/utils/string.cpp index 8a4c1cc..9727f3f 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -1,5 +1,6 @@ #include "string.hpp" +#include <iostream> #include <sstream> #include <string> #include <vector> @@ -23,6 +24,10 @@ namespace bot { std::string join_vector(const std::vector<std::string> &vec, char delimiter) { + if (vec.empty()) { + return ""; + } + std::string str; for (auto i = vec.begin(); i != vec.end() - 1; i++) { |
