From 9b9f25dc512de720908eaf58eef0539bd13d888b Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Sat, 12 Sep 2015 02:11:52 -0700 Subject: [PATCH] T357: Gracefully handle missing tags in M4A and OGG files. --- app/commands/ImportMLPMA.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/commands/ImportMLPMA.php b/app/commands/ImportMLPMA.php index a836d849..53c0b4d8 100644 --- a/app/commands/ImportMLPMA.php +++ b/app/commands/ImportMLPMA.php @@ -451,7 +451,13 @@ class ImportMLPMA extends Command { * @return array */ protected function getAtomTags($rawTags) { - $tags = $rawTags['tags']['quicktime']; + + if (array_key_exists('tags', $rawTags) && + array_key_exists('quicktime', $rawTags['tags'])) { + $tags = $rawTags['tags']['quicktime']; + } else { + $tags = []; + } $trackNumber = null; if (isset($tags['track_number'])) { @@ -480,7 +486,13 @@ class ImportMLPMA extends Command { * @return array */ protected function getVorbisTags($rawTags) { - $tags = $rawTags['tags']['vorbiscomment']; + if (array_key_exists('tags', $rawTags) && + array_key_exists('vorbiscomment', $rawTags['tags']) + ) { + $tags = $rawTags['tags']['vorbiscomment']; + } else { + $tags = []; + } $trackNumber = null; if (isset($tags['track_number'])) {