From 972af12415addb1b5d72708af5d98bd4bd1bd47a Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 1 Jul 2012 21:34:18 +0200 Subject: 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 --- src/hashcomp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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 &result, int max_l irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector &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 &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