From 6f6506df13ce6cbc8544004f1fb1333e54a2b7cf Mon Sep 17 00:00:00 2001 From: Konstantin Azizov Date: Sun, 30 Apr 2017 10:48:02 +0300 Subject: [PATCH] Fix quering for details of non-existing app --- steam/App.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/steam/App.js b/steam/App.js index f241b8a..d91906f 100644 --- a/steam/App.js +++ b/steam/App.js @@ -8,7 +8,7 @@ module.exports = (function(){ function cleanApps(apps) { var cleanedApps = []; for( var appId in apps ){ - if(apps[appId]){ + if(apps[appId] && apps[appId].success){ cleanedApps.push(new AppContainer(apps[appId].data)); } } @@ -42,7 +42,11 @@ module.exports = (function(){ client.then(function(result){ apps = cleanApps( result.data ); - deferred.resolve(apps.length === 1 ? apps[0] : apps); + if( apps.length ) { + deferred.resolve(apps.length === 1 ? apps[0] : apps); + } else { + deferred.reject(result.data); + } }) .fail(function(result){ deferred.reject(result);