From 2257406db0fd374e929def04525671c2826306c2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 18 Feb 2012 02:06:44 +0300 Subject: Fix code style. --- src/resources/image.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/resources/image.cpp') diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 0ac11f114..1e2bd6b51 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -885,10 +885,20 @@ SubImage::SubImage(Image *parent, SDL_Surface *image, mBounds.y = static_cast(y); mBounds.w = static_cast(width); mBounds.h = static_cast(height); - mInternalBounds.x = mParent->mBounds.x; - mInternalBounds.y = mParent->mBounds.y; - mInternalBounds.w = mParent->mBounds.w; - mInternalBounds.h = mParent->mBounds.h; + if (mParent) + { + mInternalBounds.x = mParent->mBounds.x; + mInternalBounds.y = mParent->mBounds.y; + mInternalBounds.w = mParent->mBounds.w; + mInternalBounds.h = mParent->mBounds.h; + } + else + { + mInternalBounds.x = 0; + mInternalBounds.y = 0; + mInternalBounds.w = 1; + mInternalBounds.h = 1; + } mUseAlphaCache = false; } -- cgit v1.2.3-60-g2f50