null textures will no longer get disposed

This commit is contained in:
Stephan Sundermann committed 2012-03-16 14:08:12 +01:00
1 parent 72a6c415ae
commit df96c39409
1 file changed
+4 -3
+4 -3
View File
@@ -471,7 +471,8 @@ namespace Vocaluxe.Lib.Draw
//Dispose all textures
for (int i = 0; i < _D3DTextures.Count; i++)
{
_D3DTextures[i].Dispose();
if(_D3DTextures[i] != null)
_D3DTextures[i].Dispose();
}
TexturedColoredVertex.GetDeclaration(_Device).Dispose();
_VertexBuffer.Dispose();
@@ -933,13 +934,13 @@ namespace Vocaluxe.Lib.Draw
{
for (int i = 0; i < _Textures.Count; i++)
{
if (_Textures[i].index == Texture.index)
if (_Textures[i].index == Texture.index && _D3DTextures[i] != null)
{
_D3DTextures[Texture.index].Dispose();
_D3DTextures[Texture.index] = null;
_Textures.RemoveAt(i);
Texture.index = -1;
Texture.ID = -1;
break;
}
}
}