mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-06-10 14:37:52 +00:00
fix: add division by zero check, return zero instead of exception
This commit is contained in:
@@ -2323,6 +2323,10 @@ function mp_mult_($p1, $p2): float|int
|
||||
*/
|
||||
function mp_div_($p1, $p2): float|int
|
||||
{
|
||||
if ($p2 == 0) {
|
||||
Log::add("Division by zero detected in mp_div_: divisor was 0. Returning 0 as fallback.", Log::WARNING, "com_sportsmanager");
|
||||
return 0;
|
||||
}
|
||||
return $p1 / $p2;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user