From 177382a1534d174ff53fb12e0a029e1fc4b34b3b Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 15 Feb 2023 02:13:30 -0500 Subject: [PATCH] deal with null players --- squadjsPlugins/db-log-addOn.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 253135c..9764aef 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -111,7 +111,7 @@ export default class DBLogPlayerTime extends DBLog { } async onPlayerConnected(info) { - if(info.player) + if(info.player){ await this.models.SteamUser.upsert({ steamID: info.player.steamID, lastName: info.player.name @@ -124,12 +124,15 @@ export default class DBLogPlayerTime extends DBLog { joinTime: info.time, joinedSeeding: this.seeding }); + } } async onPlayerDisconnected(info) { - await this.models.PlayerTime.update( + if(info.player){ + await this.models.PlayerTime.update( { leaveTime: info.time }, { where: { player: info.player.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } } - ); + ); + } } }