From fa8f3394789927a8d90836df2549fbd3d8847f6e Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 12 Aug 2016 08:49:16 +0200 Subject: [PATCH] gui: Fix division by zero in completion calc (ref #3493) --- gui/default/syncthing/core/syncthingController.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 2ac223204..a1b90d686 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -447,7 +447,11 @@ angular.module('syncthing.core') total += $scope.completion[device][folder].globalBytes; needed += $scope.completion[device][folder].needBytes; } - $scope.completion[device]._total = 100 * (1 - needed / total); + if (total == 0) { + $scope.completion[device]._total = 100; + } else { + $scope.completion[device]._total = 100 * (1 - needed / total); + } console.log("recalcCompletion", device, $scope.completion[device]); }