diff options
Diffstat (limited to 'Minecraft.Client/Textures.cpp')
| -rw-r--r-- | Minecraft.Client/Textures.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index 9a2e98a6..5349412e 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -997,8 +997,15 @@ void Textures::replaceTextureDirect(shortArray rawPixels, int w, int h, int id) void Textures::releaseTexture(int id) { + if (id <= 0) return; loadedImages.erase(id); - glDeleteTextures(id); + // TextureFree() has no bounds check and crashes on stale IDs (e.g. after + // RenderManager.Initialise() which memsets the texture table to zero). + // TextureGetTexture() IS safe — returns NULL for invalid/unallocated IDs. + if (RenderManager.TextureGetTexture(id) != NULL) + { + glDeleteTextures(id); + } } int Textures::loadHttpTexture(const wstring& url, const wstring& backup) |
