Skip to content

Commit

Permalink
gui: Fix undefined lastSeenDays error in disconnected-inactive status…
Browse files Browse the repository at this point in the history
… check (ref #8530) (#8730)

The current code assumes that lastSeenDays is always set which is not
the case when device reports its lastSeen as equal to the Unix epoch.
Thus, make sure that lastSeenDays is set before proceeding with the
disconnected-inactive status check to avoid JS errors in the browser.

Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
  • Loading branch information
tomasz1986 committed Dec 26, 2022
1 parent 473ca68 commit fb4209e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gui/default/syncthing/core/syncthingController.js
Expand Up @@ -1098,7 +1098,7 @@ angular.module('syncthing.core')
}

// Disconnected
if (!unused && $scope.deviceStats[deviceCfg.deviceID].lastSeenDays >= 7) {
if (!unused && $scope.deviceStats[deviceCfg.deviceID].lastSeenDays && $scope.deviceStats[deviceCfg.deviceID].lastSeenDays >= 7) {
return status + 'disconnected-inactive';
} else {
return status + 'disconnected';
Expand Down

0 comments on commit fb4209e

Please sign in to comment.