Fix php warning

This commit is contained in:
Christoph Hummer
2024-10-25 20:53:46 +02:00
committed by GitHub
parent f7c7f08528
commit 52901e55be

View File

@@ -632,7 +632,7 @@ function execCommand($command, $echo=true) {
function getXmlVal($xml, $element, $attr=null, $pos=0) {
$xml = (is_file($xml)) ? simplexml_load_file($xml) : simplexml_load_string($xml);
$element = $xml->xpath("//$element")[$pos];
$element = $xml->xpath("//$element")[$pos] ?? null;
return isset($element) ? (isset($element[$attr]) ? strval($element[$attr]) : strval($element)) : "";
}