Browse Source

Catch errors when mapping MAL ids on sync

develop
Timothy Warren 4 days ago
parent
commit
fec671e3cd
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      src/API/Anilist/Model.php

+ 6
- 1
src/API/Anilist/Model.php View File

@@ -269,12 +269,17 @@ final class Model
269 269
 	 */
270 270
 	private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string
271 271
 	{
272
+		if ($malId === '')
273
+		{
274
+			return NULL;
275
+		}
276
+
272 277
 		$info = $this->runQuery('MediaIdByMalId', [
273 278
 			'id' => $malId,
274 279
 			'type' => mb_strtoupper($type),
275 280
 		]);
276 281
 
277
-		if (empty($info) || empty($info['data']))
282
+		if (array_key_exists('errors', $info))
278 283
 		{
279 284
 			return NULL;
280 285
 		}

Loading…
Cancel
Save