From dee6b7964b896ec7cefb828b0298583c92ef9994 Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Sat, 5 Mar 2016 00:40:45 -0500 Subject: [PATCH] Fixed crash under specific conditions --- components/http.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/http.js b/components/http.js index 0e831aa..3ef7c17 100644 --- a/components/http.js +++ b/components/http.js @@ -97,7 +97,7 @@ SteamCommunity.prototype._checkHttpError = function(err, response, callback) { }; SteamCommunity.prototype._checkCommunityError = function(html, callback) { - if(html.match(/

Sorry!<\/h1>/)) { + if(html && html.match(/

Sorry!<\/h1>/)) { var match = html.match(/

(.+)<\/h3>/); var err = new Error(match ? match[1] : "Unknown error occurred"); callback(err); @@ -108,6 +108,10 @@ SteamCommunity.prototype._checkCommunityError = function(html, callback) { }; SteamCommunity.prototype._checkTradeError = function(html, callback) { + if (!html) { + return false; + } + var match = html.match(/
\s*([^<]+)\s*<\/div>/); if (match) { var err = new Error(match[1].trim());