Improve bitmap disposal to do null checks and not to potentially try disposal of uninitialized variables.

This issue doesn't cause the mono 2.10.5 compiler to fail but appears to cause the windows compiler to fail.
Resolves http://opensimulator.org/mantis/view.php?id=5973
0.7.4.1
Justin Clark-Casey (justincc) 2012-04-20 23:35:11 +01:00
parent 566327a948
commit c8307cdf1e
1 changed files with 7 additions and 4 deletions

View File

@ -139,8 +139,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
string tempName = Path.GetTempFileName();
Bitmap existingBitmap = null;
Bitmap thisBitmap;
Bitmap newBitmap;
Bitmap thisBitmap = null;
Bitmap newBitmap = null;
try
{
@ -176,8 +176,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
if (existingBitmap != null)
existingBitmap.Dispose();
thisBitmap.Dispose();
newBitmap.Dispose();
if (thisBitmap != null)
thisBitmap.Dispose();
if (newBitmap != null)
newBitmap.Dispose();
if (File.Exists(tempName))
File.Delete(tempName);