From 6a03f3173b63671984208d5f1ba95bb32e283ff2 Mon Sep 17 00:00:00 2001 From: Efox Date: Mon, 12 Apr 2021 21:45:16 -0300 Subject: [PATCH] Fix sessionRequest function Under some circunstances, the value of "response" at the line 93 will be: {type: "ERROR", reason: "APP_ERROR"} ...with no "status" attribute, possibly causing the process to crash. --- lib/controllers/media.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/controllers/media.js b/lib/controllers/media.js index 5cf6c1e..bf7aaf0 100644 --- a/lib/controllers/media.js +++ b/lib/controllers/media.js @@ -90,6 +90,7 @@ MediaController.prototype.sessionRequest = function(data, callback) { this.request(data, function(err, response) { if(err) return callback(err); + if(typeof(response.status) == 'undefined') return callback(response.reason || 'unknown response'); var status = response.status[0]; callback(null, status); });