From fec671e3cd5eb143c465f083a5ccbb1116f94d47 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Tue, 8 Oct 2019 19:59:47 -0400 Subject: [PATCH] Catch errors when mapping MAL ids on sync --- src/API/Anilist/Model.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/API/Anilist/Model.php b/src/API/Anilist/Model.php index 1dfbbe37..00115399 100644 --- a/src/API/Anilist/Model.php +++ b/src/API/Anilist/Model.php @@ -269,12 +269,17 @@ final class Model */ private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string { + if ($malId === '') + { + return NULL; + } + $info = $this->runQuery('MediaIdByMalId', [ 'id' => $malId, 'type' => mb_strtoupper($type), ]); - if (empty($info) || empty($info['data'])) + if (array_key_exists('errors', $info)) { return NULL; }