Catch errors when mapping MAL ids on sync
This commit is contained in:
parent
848f667626
commit
fec671e3cd
@ -269,12 +269,17 @@ final class Model
|
|||||||
*/
|
*/
|
||||||
private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string
|
private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string
|
||||||
{
|
{
|
||||||
|
if ($malId === '')
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
$info = $this->runQuery('MediaIdByMalId', [
|
$info = $this->runQuery('MediaIdByMalId', [
|
||||||
'id' => $malId,
|
'id' => $malId,
|
||||||
'type' => mb_strtoupper($type),
|
'type' => mb_strtoupper($type),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (empty($info) || empty($info['data']))
|
if (array_key_exists('errors', $info))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user