From c150a47e9392e025daa08ae9ceaecc72ba619623 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Mon, 17 Nov 2014 19:11:37 -0500 Subject: [PATCH] catch boost::bad_function_call exceptions in server command handler Don't know if this can actually happen in practice but it is reported by coverity. --- src/server/server.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/server.cpp b/src/server/server.cpp index 1bee63c6ecbc..2015092318d1 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -1387,7 +1387,12 @@ std::string server::process_command(std::string query, std::string issuer_name) out << "Command '" << command << "' is not recognized.\n" << help_msg; } else { const cmd_handler &handler = handler_itor->second; - handler(this, issuer_name, query, parameters, &out); + try { + handler(this, issuer_name, query, parameters, &out); + } catch (boost::bad_function_call & ex) { + ERR_SERVER << "While handling a command '" << command << "', caught a boost::bad_function_call exception.\n"; + ERR_SERVER << ex.what() << std::endl; + } } return out.str();