Avoid divide by 0

This commit is contained in:
james 2009-04-01 17:30:31 +00:00
parent c11967a9df
commit 4d0f607981

View File

@ -160,7 +160,11 @@ function judges_scheduler_check_judges()
echo i18n("Minimum number of judges required: %1",array($minjudges['total']))."<br />";
foreach($config['languages'] AS $lkey=>$lname) {
$minjudges[$lkey]=round($projectlanguagetotal[$lkey]/$projecttotal*$minjudges['total']);
if($minjudges['total'] && $projecttotal)
$minjudges[$lkey]=round($projectlanguagetotal[$lkey]/$projecttotal*$minjudges['total']);
else
$minjudges[$lkey]=0;
echo "&nbsp;&nbsp; ".i18n("Minimum number of %1 judges required: %2",array($lname,$minjudges[$lkey]))."<br />";
}