mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 04:59:35 -07:00
Watch out for malformed AlbumReleases in Albums
Don't try to insert if Title is empty and catch and SQLite exceptions.
This commit is contained in:
parent
c392569a63
commit
b9f707dc2f
1 changed files with 17 additions and 1 deletions
|
@ -5,6 +5,8 @@ using System.Collections.Generic;
|
||||||
using NzbDrone.Core.Music;
|
using NzbDrone.Core.Music;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Data.SQLite;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Datastore.Migration
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
|
@ -221,6 +223,12 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
foreach (var release in releases)
|
foreach (var release in releases)
|
||||||
{
|
{
|
||||||
|
if (release.Title.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
_logger.Warn("Skipping malformed AlbumRelease [{0}] '{1}'", release.ForeignReleaseId, release.Title);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
using (var writeReleaseCmd = conn.CreateCommand())
|
using (var writeReleaseCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
writeReleaseCmd.Transaction = tran;
|
writeReleaseCmd.Transaction = tran;
|
||||||
|
@ -239,7 +247,15 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
writeReleaseCmd.AddParameter(release.TrackCount);
|
writeReleaseCmd.AddParameter(release.TrackCount);
|
||||||
writeReleaseCmd.AddParameter(release.Monitored);
|
writeReleaseCmd.AddParameter(release.Monitored);
|
||||||
|
|
||||||
writeReleaseCmd.ExecuteNonQuery();
|
try
|
||||||
|
{
|
||||||
|
writeReleaseCmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch(SQLiteException e)
|
||||||
|
{
|
||||||
|
_logger.Warn("Caught SQLiteException {0}", e);
|
||||||
|
_logger.Warn("Skipping malformed AlbumRelease [{0}] '{1}'", release.ForeignReleaseId, release.Title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue