Skip to content

Commit

Permalink
Added lokking to try and remove latest NullRefException
Browse files Browse the repository at this point in the history
  • Loading branch information
SirSparkles committed Jan 8, 2019
1 parent a58d936 commit c77daab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions TVRename/Finders/LibraryFolderFileFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ protected override void Check(SetProgressDelegate prog, ICollection<ShowItem> sh
DirFilesCache dfc = new DirFilesCache();

int currentItem = 0;
int totalN = ActionList.Count + 1;
int totalN = ActionList.MissingItems().Count() + 1;
UpdateStatus(currentItem, totalN, "Starting searching through library looking for files");

LOGGER.Info("Starting to look for missing items in the library");

foreach (ItemMissing me in ActionList.MissingItems())
{
if (settings.Token.IsCancellationRequested)
Expand All @@ -29,7 +31,16 @@ protected override void Check(SetProgressDelegate prog, ICollection<ShowItem> sh

ItemList thisRound = new ItemList();

List<FileInfo> matchedFiles = dfc.GetFilesIncludeSubDirs(me.Episode.Show.AutoAddFolderBase).Where(testFile => ReviewFile(me, thisRound, testFile, settings,false,false,false)).ToList();
if (me.Episode?.Show == null)
{
LOGGER.Info($"Not looking for {me.Filename} in the library as the show/episode is null");
continue;
}

string baseFolder = me.Episode.Show.AutoAddFolderBase;
LOGGER.Info($"Starting to look for {me.Filename} in the library: {baseFolder}");

List<FileInfo> matchedFiles = dfc.GetFilesIncludeSubDirs(baseFolder).Where(testFile => ReviewFile(me, thisRound, testFile, settings,false,false,false)).ToList();

foreach (KeyValuePair<int, List<string>> seriesFolders in me.Episode.Show.AllFolderLocationsEpCheck(false))
{
Expand Down
3 changes: 2 additions & 1 deletion TVRename/Finders/SearchFolderFileFinder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Alphaleonis.Win32.Filesystem;

namespace TVRename
Expand Down Expand Up @@ -27,7 +28,7 @@ protected override void Check(SetProgressDelegate prog, ICollection<ShowItem> sh
}

int currentItem = 0;
int totalN = ActionList.Count + 1;
int totalN = ActionList.MissingItems().Count() + 1;
UpdateStatus(currentItem, totalN, "Starting searching through files");

foreach (ItemMissing me in ActionList.MissingItems())
Expand Down

0 comments on commit c77daab

Please sign in to comment.