summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-18 02:06:44 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-18 02:06:44 +0300
commit2257406db0fd374e929def04525671c2826306c2 (patch)
tree0df3ef6435664fc962b772302e716adf01855825 /src/resources/image.cpp
parent4cd44430deb5a7efc030839a133fe8510327fc24 (diff)
downloadmv-2257406db0fd374e929def04525671c2826306c2.tar.gz
mv-2257406db0fd374e929def04525671c2826306c2.tar.bz2
mv-2257406db0fd374e929def04525671c2826306c2.tar.xz
mv-2257406db0fd374e929def04525671c2826306c2.zip
Fix code style.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp18
1 files changed, 14 insertions, 4 deletions
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<short>(y);
mBounds.w = static_cast<Uint16>(width);
mBounds.h = static_cast<Uint16>(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;
}