Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}