Guard Against QualityParser NullReferenceException

pull/94/head
Qstick 7 years ago
parent 78f1066535
commit 31db4e2026

@ -333,8 +333,8 @@ namespace NzbDrone.Core.Parser
{ {
var fileInfo = new FileInfo(path); var fileInfo = new FileInfo(path);
var file = TagLib.File.Create(path); var file = TagLib.File.Create(path);
var trackName = file.Tag.Title;
var trackNumber = file.Tag.Track; var trackNumber = file.Tag.Track;
var trackTitle = file.Tag.Title;
var artist = file.Tag.FirstAlbumArtist; var artist = file.Tag.FirstAlbumArtist;
@ -359,15 +359,11 @@ namespace NzbDrone.Core.Parser
ArtistMBId = file.Tag.MusicBrainzArtistId, ArtistMBId = file.Tag.MusicBrainzArtistId,
AlbumMBId = file.Tag.MusicBrainzReleaseId, AlbumMBId = file.Tag.MusicBrainzReleaseId,
TrackMBId = file.Tag.MusicBrainzReleaseType, TrackMBId = file.Tag.MusicBrainzReleaseType,
Quality = QualityParser.ParseQuality(trackName),
TrackNumbers = temp, TrackNumbers = temp,
ArtistTitleInfo = artistTitleInfo, ArtistTitleInfo = artistTitleInfo,
Title = file.Tag.Title Title = trackTitle
}; };
Logger.Debug("Quality parsed: {0}", file.Tag.BeatsPerMinute);
foreach (TagLib.ICodec codec in file.Properties.Codecs) foreach (TagLib.ICodec codec in file.Properties.Codecs)
{ {
TagLib.IAudioCodec acodec = codec as TagLib.IAudioCodec; TagLib.IAudioCodec acodec = codec as TagLib.IAudioCodec;
@ -381,6 +377,7 @@ namespace NzbDrone.Core.Parser
Logger.Debug("Channels: " + acodec.AudioChannels + "\n"); Logger.Debug("Channels: " + acodec.AudioChannels + "\n");
result.Quality = QualityParser.ParseQuality(acodec.Description, acodec.AudioBitrate, acodec.AudioSampleRate); result.Quality = QualityParser.ParseQuality(acodec.Description, acodec.AudioBitrate, acodec.AudioSampleRate);
Logger.Debug("Quality parsed: {0}", result.Quality);
} }

Loading…
Cancel
Save