prevent undefined/null values breaking graphs or scales
This commit is contained in:
@ -45,6 +45,10 @@ class ServerRegistration {
|
||||
getUpdate (timestamp, resp, err, version) {
|
||||
const update = {}
|
||||
|
||||
// Always append a playerCount value
|
||||
// When resp is undefined (due to an error), playerCount will be null
|
||||
update.playerCount = getPlayerCountOrNull(resp)
|
||||
|
||||
if (resp) {
|
||||
if (resp.version && this.updateProtocolVersionCompat(resp.version, version.protocolId, version.protocolIndex)) {
|
||||
// Append an updated version listing
|
||||
@ -65,10 +69,6 @@ class ServerRegistration {
|
||||
update.favicon = this.getFaviconUrl()
|
||||
}
|
||||
|
||||
// Append a result object
|
||||
// This filters out unwanted data from resp
|
||||
update.playerCount = resp.players.online
|
||||
|
||||
if (config.logToDatabase) {
|
||||
// Update calculated graph peak regardless if the graph is being updated
|
||||
// This can cause a (harmless) desync between live and stored data, but it allows it to be more accurate for long surviving processes
|
||||
|
Reference in New Issue
Block a user