Handle no image being returned by tinyfox.dev

This commit is contained in:
floppydiskette 2024-12-09 20:48:27 +00:00
commit 5596afa450
2 changed files with 10 additions and 3 deletions

View file

@ -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 "";
}