diff --git a/app/Classes/Pterodactyl.php b/app/Classes/Pterodactyl.php index 30d95681..a0b5c99a 100644 --- a/app/Classes/Pterodactyl.php +++ b/app/Classes/Pterodactyl.php @@ -49,8 +49,12 @@ class Pterodactyl $response = self::getAllocations($node); $freeAllocations = []; - foreach ($response['data'] as $allocation) { - if (!$allocation['attributes']['assigned']) array_push($freeAllocations, $allocation); + if(isset($response['data'])){ + if (!empty($response['data'])) { + foreach ($response['data'] as $allocation) { + if (!$allocation['attributes']['assigned']) array_push($freeAllocations, $allocation); + } + } } return $freeAllocations;