Skip to content

Commit

Permalink
Cover undefined command case
Browse files Browse the repository at this point in the history
  • Loading branch information
javo committed Jan 19, 2017
1 parent 049267a commit 7200992
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/agent/plugins/control-panel/long-polling/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,10 @@ var request = function(re_schedule) {
}

function process_commands(arr) {
console.log("TYPE:", typeof arr);
console.log("PROCESS!!", arr)

if (util.isBuffer(arr)) {
console.log("IS BUFFER");
console.log("String:", arr.toString())
arr = JSON.parse("{" + arr.toString() + "}")["instruction"]
} else {
console.log("NOT BUFFER :(")
if (arr.toString() == "\n") return;
arr = JSON.parse("{" + arr.toString() + "}")["instruction"] || arr
}
// var arr2 = JSON.parse("{" + arr.toString() + "}");
// arr = arr2["instruction"];

if (arr.forEach) {
arr.forEach(function(el) {
var cmd = el.target ? el : parse_cmd(el);
Expand Down

0 comments on commit 7200992

Please sign in to comment.