From c4a1457603f85894ee9392949c76b7ea89a077de Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 5 Dec 2014 12:19:50 -0400 Subject: [PATCH] Fixed Image:setMipmapFilter keeping bad state around if it errors. --- src/modules/graphics/opengl/Image.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/Image.cpp b/src/modules/graphics/opengl/Image.cpp index 7aa7ca171..c9020e7a2 100644 --- a/src/modules/graphics/opengl/Image.cpp +++ b/src/modules/graphics/opengl/Image.cpp @@ -256,6 +256,7 @@ void Image::checkMipmapsCreated() void Image::setFilter(const Texture::Filter &f) { + const Filter oldfilter = filter; filter = f; // We don't want filtering or (attempted) mipmaps on the default texture. @@ -267,7 +268,18 @@ void Image::setFilter(const Texture::Filter &f) bind(); gl.setTextureFilter(filter); - checkMipmapsCreated(); + + try + { + checkMipmapsCreated(); + } + catch (love::Exception &) + { + // Don't keep the new mipmap filter if we can't create mipmaps. + filter = oldfilter; + gl.setTextureFilter(filter); + throw; + } } void Image::setWrap(const Texture::Wrap &w)