From a3b2076ba0b398523c3e0428c2400184e83c4f62 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 2 Mar 2013 21:19:28 +0300 Subject: Last fixes after Coverity checks. --- src/graphics.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/graphics.cpp') diff --git a/src/graphics.cpp b/src/graphics.cpp index 0e3f19544..e220775a7 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -659,10 +659,15 @@ bool Graphics::calcImageRect(ImageVertexes *const vert, } calcTile(vert, topLeft, x, y); - calcTile(vert, topRight, x + w - topRight->getWidth(), y); - calcTile(vert, bottomLeft, x, y + h - bottomLeft->getHeight()); - calcTile(vert, bottomRight, x + w - bottomRight->getWidth(), - y + h - bottomRight->getHeight()); + if (topRight) + calcTile(vert, topRight, x + w - topRight->getWidth(), y); + if (bottomLeft) + calcTile(vert, bottomLeft, x, y + h - bottomLeft->getHeight()); + if (bottomRight) + { + calcTile(vert, bottomRight, x + w - bottomRight->getWidth(), + y + h - bottomRight->getHeight()); + } // popClipArea(); BLOCK_END("Graphics::calcImageRect") @@ -711,6 +716,10 @@ void Graphics::calcImagePattern(ImageVertexes* const vert, { vert->sdl.push_back(r); } + else + { + delete r; + } } } } @@ -989,11 +998,14 @@ int Graphics::SDL_FakeUpperBlit(const SDL_Surface *const src, if (w > 0 && h > 0) { - srcrect->x = static_cast(srcx); - srcrect->y = static_cast(srcy); - srcrect->w = static_cast(w); + if (srcrect) + { + srcrect->x = static_cast(srcx); + srcrect->y = static_cast(srcy); + srcrect->w = static_cast(w); + srcrect->h = static_cast(h); + } dstrect->w = static_cast(w); - srcrect->h = static_cast(h); dstrect->h = static_cast(h); return 1; -- cgit v1.2.3-60-g2f50