From 233f3509e28efcfcf6839465932602957cad03c9 Mon Sep 17 00:00:00 2001 From: jetwitaussi Date: Mon, 25 Mar 2019 20:42:51 +0100 Subject: [PATCH] Fix youth player last match --- PHT/Xml/Player/Youth.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PHT/Xml/Player/Youth.php b/PHT/Xml/Player/Youth.php index 40c4958..b1304fa 100644 --- a/PHT/Xml/Player/Youth.php +++ b/PHT/Xml/Player/Youth.php @@ -566,9 +566,10 @@ public function getScoutCall() */ public function getLastMatch() { - if ($this->getXml()->getElementsByTagName('LastMatch')->length) { + $node = $this->getXml()->getElementsByTagName('LastMatch')->item(0); + if ($node !== null && $node->hasChildNodes()) { $match = new \DOMDocument('1.0', 'UTF-8'); - $match->appendChild($match->importNode($this->getXml()->getElementsByTagName('LastMatch')->item(0), true)); + $match->appendChild($match->importNode($node, true)); return new LastMatch($match, Config\Config::MATCH_YOUTH); } return null;