summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-28 13:47:32 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-28 13:47:32 +0300
commitfbcfa27edf518835976e140ec160db009186bc16 (patch)
tree52e2999ffe9ba3971f2b4334be7c8c42754a7e03 /src/resources
parentcaf62e4d1c039f8d4d33bfd05f476890fdc79fcf (diff)
downloadmv-fbcfa27edf518835976e140ec160db009186bc16.tar.gz
mv-fbcfa27edf518835976e140ec160db009186bc16.tar.bz2
mv-fbcfa27edf518835976e140ec160db009186bc16.tar.xz
mv-fbcfa27edf518835976e140ec160db009186bc16.zip
Fix code style and add some checks.
Diffstat (limited to 'src/resources')
-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 274262304..fa9f1462a 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -940,10 +940,20 @@ SubImage::SubImage(Image *parent, GLuint 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;
+ }
mIsAlphaVisible = mHasAlphaChannel;
}
#endif