Skip to content

Commit

Permalink
Fix if <flags> are not present in monster.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Jun 5, 2024
1 parent 9ea2a50 commit 57b47ab
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions system/libs/pot/OTS_Monster.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ public function getFlags()
{
$flags = array();

// read all flags
foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
{
$flag = $flag->attributes->item(0);

$flags[$flag->nodeName] = (int) $flag->nodeValue;
}
if ($this->documentElement->getElementsByTagName('flags')->item(0)) {
foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
{
$flag = $flag->attributes->item(0);

$flags[$flag->nodeName] = (int) $flag->nodeValue;
}
}

return $flags;
}
Expand Down

0 comments on commit 57b47ab

Please sign in to comment.