Skip to content

Commit

Permalink
Fix if loot is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Oct 24, 2024
1 parent 3100faa commit b8c0215
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion system/pages/monsters.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ function sort_by_chance($a, $b)
$elements = json_decode($monster['elements'], true);
$immunities = json_decode($monster['immunities'], true);
$loot = json_decode($monster['loot'], true);
usort($loot, 'sort_by_chance');
if (!empty($loot)) {
usort($loot, 'sort_by_chance');
}

foreach ($loot as &$item) {
$item['name'] = getItemNameById($item['id']);
Expand Down

0 comments on commit b8c0215

Please sign in to comment.