From fb4209e382ffa08d53f96569d91f5c4fe172d622 Mon Sep 17 00:00:00 2001 From: tomasz1986 Date: Mon, 26 Dec 2022 12:59:04 +0100 Subject: [PATCH] gui: Fix undefined lastSeenDays error in disconnected-inactive status check (ref #8530) (#8730) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gui/default/syncthing/core/syncthingController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 683504c24..f61f0b0cf 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -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';