Handle no image being returned by tinyfox.dev
This commit is contained in:
parent
27116d79ce
commit
5596afa450
2 changed files with 10 additions and 3 deletions
|
@ -21,7 +21,9 @@ public function getWah(): string {
|
|||
try {
|
||||
$response = Http::get('https://api.tinyfox.dev/img.json?animal=wah');
|
||||
$data = $response->json();
|
||||
return "https://api.tinyfox.dev".$data["loc"];
|
||||
if ($data == null) return "";
|
||||
return "https://api.tinyfox.dev" . $data["loc"];
|
||||
|
||||
} catch (Exception $ex) {
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue