diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-07-11 00:12:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-11 00:12:28 +0300 |
commit | ee75580d40c5c444d184a6ecbeb99493ba42085a (patch) | |
tree | 2db8ff3378810b33c8713d8e4eda1511c36ccb06 /src/resources/openglimagehelper.cpp | |
parent | 4fbb944f132eb886a6f5b350e5a14a4fe380aacf (diff) | |
download | manaverse-ee75580d40c5c444d184a6ecbeb99493ba42085a.tar.gz manaverse-ee75580d40c5c444d184a6ecbeb99493ba42085a.tar.bz2 manaverse-ee75580d40c5c444d184a6ecbeb99493ba42085a.tar.xz manaverse-ee75580d40c5c444d184a6ecbeb99493ba42085a.zip |
Add missing checks into resources.
Diffstat (limited to 'src/resources/openglimagehelper.cpp')
-rw-r--r-- | src/resources/openglimagehelper.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index ca553a180..bf051fc0c 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -67,6 +67,8 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye) SDL_Surface *const surf = convertTo32Bit(tmpImage); MSDL_FreeSurface(tmpImage); + if (!surf) + return nullptr; uint32_t *pixels = static_cast<uint32_t *>(surf->pixels); const int type = dye.getType(); @@ -291,6 +293,8 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, SDL_Surface *oldImage = tmpImage; tmpImage = convertSurfaceNormalize(tmpImage, width, height); + if (!tmpImage) + return nullptr; const int realWidth = tmpImage->w; const int realHeight = tmpImage->h; @@ -438,6 +442,8 @@ void OpenGLImageHelper::copySurfaceToImage(const Image *const image, SDL_Surface *const oldSurface = surface; surface = convertSurface(surface, surface->w, surface->h); + if (!surface) + return; mglTextureSubImage2D(image->mGLImage, mTextureType, 0, |