summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2012-07-01 21:34:18 +0200
committerRobin Burchell <robin+git@viroteck.net>2012-07-01 21:35:32 +0200
commit972af12415addb1b5d72708af5d98bd4bd1bd47a (patch)
treeba14b1e483b8f996edd4765794a38517ee108afc /src
parent9475a10a86c6c2e8575366f6e0c9b28b66a97698 (diff)
Don't throw an exception if passed bad parameters to stringjoiner.
It's far too common to "misuse" this API by accidentally trying to use stringjoiner with an empty container, and fixing that is more or less adding boilerplate in every place we fix it. Instead, let's just return and not touch the string, and not throw. Done-with: Attila Molnar <attilamolnar@hush.com>
Diffstat (limited to 'src')
-rw-r--r--src/hashcomp.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 8c34c8a56..92de37e61 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -451,7 +451,7 @@ int irc::modestacker::GetStackedLine(std::vector<std::string> &result, int max_l
irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector<std::string> &sequence, int begin, int end)
{
if (end < begin)
- throw "stringjoiner logic error, this causes problems.";
+ return; // nothing to do here
for (int v = begin; v < end; v++)
joined.append(sequence[v]).append(seperator);
@@ -461,7 +461,7 @@ irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector<
irc::stringjoiner::stringjoiner(const std::string &seperator, const std::deque<std::string> &sequence, int begin, int end)
{
if (end < begin)
- throw "stringjoiner logic error, this causes problems.";
+ return; // nothing to do here
for (int v = begin; v < end; v++)
joined.append(sequence[v]).append(seperator);
@@ -471,7 +471,7 @@ irc::stringjoiner::stringjoiner(const std::string &seperator, const std::deque<s
irc::stringjoiner::stringjoiner(const std::string &seperator, const char* const* sequence, int begin, int end)
{
if (end < begin)
- throw "stringjoiner logic error, this causes problems.";
+ return; // nothing to do here
for (int v = begin; v < end; v++)
joined.append(sequence[v]).append(seperator);