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,13 +456,19 @@ namespace SabreTools
catch (InvalidOperationException)
{
encounteredErrors = true;
archive.Dispose();
if (archive != null)
{
archive.Dispose();
}
}
catch (Exception ex)
{
_logger.Error(ex.ToString());
encounteredErrors = true;
archive.Dispose();
if (archive != null)
{
archive.Dispose();
}
}
}