fix: add division by zero check, return zero instead of exception

This commit is contained in:
Marvin Flock
2025-06-29 16:44:18 +02:00
parent 9289843cb1
commit 4ecf48d02e
3 changed files with 7 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
This is no official release!
The Release and the release notes will be generated by github actions
@@ -2323,6 +2323,10 @@ function mp_mult_($p1, $p2): float|int
*/ */
function mp_div_($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; return $p1 / $p2;
} }
@@ -40,7 +40,7 @@ function addOnLoad($function): void
<?php <?php
} }
function SportsManagerURL($weitereParameter = null, $ssl = 0): ?string function SportsManagerURL($weitereParameter = "", $ssl = 0): ?string
{ {
$urlPath = handleFilter($weitereParameter); $urlPath = handleFilter($weitereParameter);
$joomlaBaseUrl = Uri::getInstance()->toString([ $joomlaBaseUrl = Uri::getInstance()->toString([