: bharatvaj/forwarder

commit 30534b1f0f20f0157adf6525ac088d7d8ae56e26
parent 9a45645ab6dd19ee659b256990a23500a0ec703a
Author: Bharatvaj H <bharatvaj@yahoo.com>
Date: Wed, 27 Mar 2019 17:24:22 +0530

Fixed CLI help bug
1 file changed, 4 insertions(+), 2 deletions(-)
M
forwarder.cpp
|
6
++++--
diff --git a/forwarder.cpp b/forwarder.cpp
@@ -130,14 +130,16 @@ void help(shell4c::Operation op, vector<string> messages) {
   auto ops = shell.getOperations();
   if (messages.size() == 0) {
     for (auto op : ops) {
+      if(op.second == nullptr)continue;
       shell.println(fmt::format("\u001b[33m{}\u001b[0m\t- {}", op.first, op.second->description));
     }
     return;
   }
   for (auto msg : messages) {
     if (ops.find(msg) != ops.end()) {
-      shell4c::Operation op = *ops[msg];
-      shell.println(op.usage);
+      shell4c::Operation *op = ops[msg];
+      if(op == nullptr) continue;
+      shell.println(op->usage);
     }
   }
 }