Skip to content

Commit

Permalink
fix: null catching in uri for controller check cron
Browse files Browse the repository at this point in the history
fixes #644
  • Loading branch information
blt950 committed Oct 8, 2023
1 parent 3623d1e commit 06c5776
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/Console/Commands/CheckOnlineControllers.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ public function handle()
$this->info('Collecting online controllers...');

// Fetch the latest URI to data feed
$dataUri = Http::get('https://status.vatsim.net/status.json')['data']['v3'][0];
$dataReturn = Http::get($dataUri);
$dataUri = Http::get('https://status.vatsim.net/status.json');
if (! isset($dataUri) || ! isset($dataUri['data']) || ! isset($dataUri['data']['v3']) || ! isset($dataUri['data']['v3'][0])) {
$this->info('No data URI found. Aborting.');

return;
}

$dataReturn = Http::get($dataUri['data']['v3'][0]);

if (isset($dataReturn)) {
$vatsimData = $dataReturn['controllers'];
Expand Down

0 comments on commit 06c5776

Please sign in to comment.