From 0802a20f4f7b5eff129dd580c1e309669cb1e827 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Tue, 29 Jun 2021 11:38:13 -0700 Subject: [PATCH] Do not save invalid disconnect time --- core/stats.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/stats.go b/core/stats.go index 121942f76..3f716ce9e 100644 --- a/core/stats.go +++ b/core/stats.go @@ -136,8 +136,10 @@ func saveStats() error { if err := data.SetPeakSessionViewerCount(_stats.SessionMaxViewerCount); err != nil { log.Errorln("error saving viewer count", err) } - if err := data.SetLastDisconnectTime(_stats.LastConnectTime.Time); err != nil { - log.Errorln("error saving disconnect time", err) + if _stats.LastDisconnectTime.Valid { + if err := data.SetLastDisconnectTime(_stats.LastConnectTime.Time); err != nil { + log.Errorln("error saving disconnect time", err) + } } return nil