Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-01-28 19:09:32 +0000
committerStijn Buys <ingar@osirion.org>2012-01-28 19:09:32 +0000
commit261ff1787c0076cad71a57343df221180ae94188 (patch)
treeff96d7d1a34ba51707b1f87912429f61535bed3b /src/render/textures.cc
parent986ca13bdbc90bccf8c3e7c05e5c809dea1551fc (diff)
Prevent Textures::unload() from unloading the 'image not found' texture.
Diffstat (limited to 'src/render/textures.cc')
-rw-r--r--src/render/textures.cc6
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;
}