From 27001faf957775ac461690f65e28e2c37eff001a Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 27 Sep 2019 18:00:28 +0200 Subject: [PATCH] Fixed a Division by zero warning --- src/Tournament.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Tournament.php b/src/Tournament.php index cf06cb7..f5b53be 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -650,7 +650,11 @@ class Tournament } sort($allratings); $allratings = array_slice($allratings, $cut); - return round(array_sum($allratings) / count($allratings)); + $tiebreak = 0; + if (count($allratings) > 0) { + $tiebreak = round(array_sum($allratings) / count($allratings)); + } + return $tiebreak; }