diff options
author | Stijn Buys <ingar@osirion.org> | 2012-01-28 19:09:32 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-01-28 19:09:32 +0000 |
commit | 261ff1787c0076cad71a57343df221180ae94188 (patch) | |
tree | ff96d7d1a34ba51707b1f87912429f61535bed3b /src/render | |
parent | 986ca13bdbc90bccf8c3e7c05e5c809dea1551fc (diff) |
Prevent Textures::unload() from unloading the 'image not found' texture.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/textures.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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; } |