mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-30 02:10:09 +08:00
Fixed crash under specific conditions
This commit is contained in:
parent
2fc434d475
commit
dee6b7964b
@ -97,7 +97,7 @@ SteamCommunity.prototype._checkHttpError = function(err, response, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SteamCommunity.prototype._checkCommunityError = function(html, callback) {
|
SteamCommunity.prototype._checkCommunityError = function(html, callback) {
|
||||||
if(html.match(/<h1>Sorry!<\/h1>/)) {
|
if(html && html.match(/<h1>Sorry!<\/h1>/)) {
|
||||||
var match = html.match(/<h3>(.+)<\/h3>/);
|
var match = html.match(/<h3>(.+)<\/h3>/);
|
||||||
var err = new Error(match ? match[1] : "Unknown error occurred");
|
var err = new Error(match ? match[1] : "Unknown error occurred");
|
||||||
callback(err);
|
callback(err);
|
||||||
@ -108,6 +108,10 @@ SteamCommunity.prototype._checkCommunityError = function(html, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SteamCommunity.prototype._checkTradeError = function(html, callback) {
|
SteamCommunity.prototype._checkTradeError = function(html, callback) {
|
||||||
|
if (!html) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var match = html.match(/<div id="error_msg">\s*([^<]+)\s*<\/div>/);
|
var match = html.match(/<div id="error_msg">\s*([^<]+)\s*<\/div>/);
|
||||||
if (match) {
|
if (match) {
|
||||||
var err = new Error(match[1].trim());
|
var err = new Error(match[1].trim());
|
||||||
|
Loading…
Reference in New Issue
Block a user