From 08932ba8d28e2c6836770b4990504c6b162417a7 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 7 Oct 2021 21:45:17 -0400 Subject: [PATCH] Make some anime detail pages more robust --- src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php index 1a2caf00..6da23ae1 100644 --- a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php +++ b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php @@ -88,6 +88,13 @@ final class AnimeTransformer extends AbstractTransformer { $role = $staffing['role']; $name = $person['names']['localized'][$person['names']['canonical']]; + // If this person object is so broken as to not have a proper image object, + // just skip it. No point in showing a role with nothing in it. + if ($person === null || $person['id'] === null || $person['image'] === null || $person['image']['original'] === null) + { + continue; + } + if ( ! array_key_exists($role, $staff)) { $staff[$role] = [];