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:
@@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user