aboutsummaryrefslogtreecommitdiff
path: root/src/hashcomp.cpp
diff options
context:
space:
mode:
authorGravatar Robin Burchell2012-07-01 21:34:18 +0200
committerGravatar Robin Burchell2012-07-01 21:35:32 +0200
commit972af12415addb1b5d72708af5d98bd4bd1bd47a (patch)
treeba14b1e483b8f996edd4765794a38517ee108afc /src/hashcomp.cpp
parentm_xline_db Fix memory leak when adding a loaded xline fails (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/hashcomp.cpp')
-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);