From 261ff1787c0076cad71a57343df221180ae94188 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 28 Jan 2012 19:09:32 +0000 Subject: Prevent Textures::unload() from unloading the 'image not found' texture. --- src/render/textures.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/render/textures.cc') diff --git a/src/render/textures.cc b/src/render/textures.cc index 687d245..ab490a6 100644 --- a/src/render/textures.cc +++ b/src/render/textures.cc @@ -98,7 +98,8 @@ void Textures::unload(const std::string &name) if (it != registry.end()) { con_debug << " unloading " << (*it).first << std::endl; size_t id = (*it).second; - if (textures[id]) { + // do not unload texture id 0, 'unkown texture' + if (id && textures[id]) { glDeleteTextures(1, &textures[id]); textures[id] = 0; texture_size[id].clear(); @@ -114,7 +115,8 @@ void Textures::unload(const size_t id) if ((*it).second == id) { con_debug << " unloading " << (*it).first << std::endl; size_t id = (*it).second; - if (textures[id]) { + // do not unload texture id 0, 'unkown texture' + if (id && textures[id]) { glDeleteTextures(1, &textures[id]); textures[id] = 0; } -- cgit v1.2.3