diff --git a/core/data/config.go b/core/data/config.go index 6215b8158..d46f5d5b0 100644 --- a/core/data/config.go +++ b/core/data/config.go @@ -328,14 +328,20 @@ func SetPeakOverallViewerCount(count int) error { // GetLastDisconnectTime will return the time the last stream ended. func GetLastDisconnectTime() (utils.NullTime, error) { - var disconnectTime = utils.NullTime{time.Now(), false} + invalidTime := utils.NullTime{Time: time.Now(), Valid: false} + var disconnectTime utils.NullTime + configEntry, err := _datastore.Get(lastDisconnectTimeKey) if err != nil { - return disconnectTime, err + return invalidTime, err } if err := configEntry.getObject(&disconnectTime); err != nil { - return disconnectTime, err + return invalidTime, err + } + + if !disconnectTime.Valid { + return invalidTime, err } return disconnectTime, nil