Ver código fonte

Add a default value for line_no

dustin.born 7 anos atrás
pai
commit
487c7085fe
1 arquivos alterados com 1 adições e 4 exclusões
  1. 1 4
      code_boost/src/cxx/botnet_comm_processor.cpp

+ 1 - 4
code_boost/src/cxx/botnet_comm_processor.cpp

@@ -26,11 +26,8 @@ void botnet_comm_processor::set_messages(const py::list &messages_pyboost){
         unsigned int dst_id = std::stoi(py::extract<std::string>(msg_pyboost["Dst"]));
         unsigned short type = (unsigned short) std::stoi(py::extract<std::string>(msg_pyboost["Type"]));
         double time = std::stod(py::extract<std::string>(msg_pyboost["Time"]));
+        int line_no = std::stoi(py::extract<std::string>(msg_pyboost.get("LineNumber", "-1")));
 
-        int line_no = -1;
-        // try {
-        line_no = std::stoi(py::extract<std::string>(msg_pyboost["LineNumber"]));
-        // }
         abstract_msg msg = {src_id, dst_id, type, time, line_no};
         messages.push_back(std::move(msg));
     }