Dispose only if there's something to dispose

This commit is contained in:
Matt Nadareski
2016-05-23 12:11:22 -07:00
parent 79d1da0583
commit 5b48934eb3
2 changed files with 9 additions and 3 deletions

View File

@@ -456,15 +456,21 @@ namespace SabreTools
catch (InvalidOperationException)
{
encounteredErrors = true;
if (archive != null)
{
archive.Dispose();
}
}
catch (Exception ex)
{
_logger.Error(ex.ToString());
encounteredErrors = true;
if (archive != null)
{
archive.Dispose();
}
}
}
// Get a list of files including size and hashes
Crc32 crc = new Crc32();

View File

@@ -11,7 +11,7 @@ namespace SabreTools.Helper
/// - Create log files by date
/// - Clean up log files if there are more than x number per program
/// - Allow for "triggerable" logging done on an interval (async)
/// - Log filtering?
/// - Log filtering? (#if debug?)
/// </remarks>
public class Logger
{