summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-08-29 08:40:33 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2013-08-29 08:40:33 -0700
commit0104d3df960c9b834e8b56b654acfc16c3a7bdd8 (patch)
treef0cb346e8a4b12fd2810492a8ef23109c61b37a8
parent2cfcf0083fcf0a82060451f4efb31bc18c06b6a7 (diff)
parent6e8bc13aa3befba15e3df17cb32ef54d447fbfec (diff)
downloadnextcloud-server-0104d3df960c9b834e8b56b654acfc16c3a7bdd8.tar.gz
nextcloud-server-0104d3df960c9b834e8b56b654acfc16c3a7bdd8.zip
Merge pull request #4592 from owncloud/fix-logic
fix weird logical behaviour
-rw-r--r--lib/helper.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/helper.php b/lib/helper.php
index dd2476eda5c..cfb29028ee3 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -858,10 +858,8 @@ class OC_Helper {
} else {
$total = $free; //either unknown or unlimited
}
- if ($total == 0) {
- $total = 1; // prevent division by zero
- }
- if ($total >= 0) {
+ if ($total > 0) {
+ // prevent division by zero or error codes (negative values)
$relative = round(($used / $total) * 10000) / 100;
} else {
$relative = 0;