fix crash on older GFE versions

This commit is contained in:
R. Aidan Campbell 2016-07-24 15:32:37 -04:00
parent 68cfba608e
commit a09b5e7ea9

View File

@ -122,11 +122,12 @@ NvHTTP.prototype = {
_self.currentGame = parseInt($root.find("currentgame").text().trim(), 10);
_self.serverMajorVersion = parseInt($root.find("appversion").text().trim().substring(0, 1), 10);
_self.serverUid = $root.find('uniqueid').text().trim();
_self.hostname = $root.find('hostname').text().trim();
_self.externalIP = $root.find('ExternalIP').text().trim();
try { // these aren't critical for functionality, and don't necessarily exist in older GFE versions.
_self.GfeVersion = $root.find('GfeVersion').text().trim();
_self.gputype = $root.find('gputype').text().trim();
_self.numofapps = $root.find('numofapps').text().trim();
_self.hostname = $root.find('hostname').text().trim();
_self.externalIP = $root.find('ExternalIP').text().trim();
// now for the hard part: parsing the supported streaming
$root.find('DisplayMode').each(function(index, value) { // for each resolution:FPS object
var yres = parseInt($(value).find('Height').text());
@ -138,8 +139,11 @@ NvHTTP.prototype = {
if(!_self.supportedDisplayModes[yres + ':' + xres].includes(fps)) {
_self.supportedDisplayModes[yres + ':' + xres].push(fps);
}
});
} catch (err) {
// we don't need this data, so no error handling necessary
}
// GFE 2.8 started keeping currentgame set to the last game played. As a result, it no longer
// has the semantics that its name would indicate. To contain the effects of this change as much