Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

Commit

Permalink
Make sure we do not get null as response
Browse files Browse the repository at this point in the history
  • Loading branch information
robbanl committed Jan 9, 2022
1 parent 9422aa8 commit 6af6f00
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Directives/GlobalSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ class GlobalSet

public function handleKey(string $handle, string $key = null)
{
return $this->globalSet($handle)->get($key);
$globalSet = $this->globalSet($handle);

if (is_null($globalSet)) {
return null;
}

return $globalSet->get($key);
}

public function handle(string $handle)
Expand All @@ -26,6 +32,12 @@ public function handle(string $handle)

private function globalSet(string $handle)
{
return GlobalSetAPI::findByHandle($handle)->inCurrentSite();
$handle = GlobalSetAPI::findByHandle($handle);

if (is_null($handle)) {
return null;
}

return $handle->inCurrentSite();
}
}

0 comments on commit 6af6f00

Please sign in to comment.