Skip to content

Commit

Permalink
bug fixes (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
arayama authored Jan 14, 2022
1 parent 43d8723 commit 1cf6f14
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/v2i-hub/MessageReceiverPlugin/src/MessageReceiverPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,17 @@ int MessageReceiverPlugin::Main()
const char *cmd=cmd1.c_str();
char buffer[2048];
std::string result="";
FILE* pipe= popen(cmd,"r");
FILE* pipemsg= popen(cmd,"r");

if (pipe == NULL ) throw std::runtime_error("popen() failed!");
if (pipemsg == NULL ) throw std::runtime_error("popen() failed!");

try{
while (fgets(buffer, sizeof(buffer),pipe) != NULL)
while (fgets(buffer, sizeof(buffer),pipemsg) != NULL)
{
result+=buffer;
}
} catch (...) {
pclose(pipe);
pclose(pipemsg);
throw;
}
cJSON *root = cJSON_Parse(result.c_str());
Expand Down Expand Up @@ -603,7 +603,7 @@ int MessageReceiverPlugin::Main()
}
}

this->IncomingMessage(extractedpayload.data(), txlen, enc.empty() ? NULL : enc.c_str(), 0, 0, time);
this->IncomingMessage(extractedpayload.data(), txlen, enc.empty() ? nullptr : enc.c_str(), 0, 0, time);

}
else if (len < 0)
Expand Down

0 comments on commit 1cf6f14

Please sign in to comment.