Dispose earlier in FixClassicTilesets.

Ensure we dispose the stream we opened right away to avoid leaving it open when an exception occurs.
This commit is contained in:
RoosterDragon
2015-09-06 19:55:00 +01:00
parent 7912e3c7ff
commit 286372fedf

View File

@@ -54,7 +54,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
foreach (var ext in exts) foreach (var ext in exts)
{ {
Stream s; Stream s;
if (!GlobalFileSystem.TryOpen(template.Images[0] + ext, out s)) if (GlobalFileSystem.TryOpen(template.Images[0] + ext, out s))
s.Dispose();
else
continue; continue;
// Rewrite the template image (normally readonly) using reflection // Rewrite the template image (normally readonly) using reflection
@@ -91,8 +93,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (template.TilesCount > 1 && template.Size == single) if (template.TilesCount > 1 && template.Size == single)
pickAnyField.SetValue(template, true); pickAnyField.SetValue(template, true);
s.Dispose();
} }
} }