aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-03-12 16:08:27 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-03-12 16:08:27 +0100
commite0992467867e4832b3333fb0cb5a638d05250bd3 (patch)
tree09f28bdf055e681ab75e2f04b03c4c864d5373d5 /src
parent8d80d831227cc0d74a90c210e40e17bd6394f4d2 (diff)
downloaddabmod-e0992467867e4832b3333fb0cb5a638d05250bd3.tar.gz
dabmod-e0992467867e4832b3333fb0cb5a638d05250bd3.tar.bz2
dabmod-e0992467867e4832b3333fb0cb5a638d05250bd3.zip
RC: avoid zmq RC crash on 'show' of non-existing controllable
Diffstat (limited to 'src')
-rw-r--r--src/RemoteControl.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp
index 808153a..1065456 100644
--- a/src/RemoteControl.cpp
+++ b/src/RemoteControl.cpp
@@ -523,16 +523,21 @@ void RemoteControllerZmq::process()
}
else if (msg.size() == 2 && command == "show") {
std::string module((char*) msg[1].data(), msg[1].size());
- list< vector<string> > r = rcs.get_param_list_values(module);
- size_t r_size = r.size();
- for (auto &param_val : r) {
- std::stringstream ss;
- ss << param_val[0] << ": " << param_val[1] << endl;
- zmq::message_t zmsg(ss.str().size());
- memcpy(zmsg.data(), ss.str().data(), ss.str().size());
-
- int flag = (--r_size > 0) ? ZMQ_SNDMORE : 0;
- repSocket.send(zmsg, flag);
+ try {
+ list< vector<string> > r = rcs.get_param_list_values(module);
+ size_t r_size = r.size();
+ for (auto &param_val : r) {
+ std::stringstream ss;
+ ss << param_val[0] << ": " << param_val[1] << endl;
+ zmq::message_t zmsg(ss.str().size());
+ memcpy(zmsg.data(), ss.str().data(), ss.str().size());
+
+ int flag = (--r_size > 0) ? ZMQ_SNDMORE : 0;
+ repSocket.send(zmsg, flag);
+ }
+ }
+ catch (const ParameterError &err) {
+ send_fail_reply(repSocket, err.what());
}
}
else if (msg.size() == 3 && command == "get") {