瀏覽代碼

Isseu: Pterodactyl zero allocations found #24

AVMG20 4 年之前
父節點
當前提交
137f54818d
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      app/Classes/Pterodactyl.php

+ 6 - 2
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;