Handle error when splash image is missing. >From pull request: https://github.com/apache/cordova-plugin-splashscreen/pull/1
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/d799eda0 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/d799eda0 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/d799eda0 Branch: refs/heads/master Commit: d799eda0204f4fee7a8ca8b9ba9c844b69a9d56a Parents: 9541c1e Author: Nathan Peles <[email protected]> Authored: Fri Dec 6 14:38:01 2013 -0500 Committer: Andrew Grieve <[email protected]> Committed: Fri Dec 6 14:38:28 2013 -0500 ---------------------------------------------------------------------- src/ios/CDVSplashScreen.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/d799eda0/src/ios/CDVSplashScreen.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m index a1c11c3..bba7deb 100644 --- a/src/ios/CDVSplashScreen.m +++ b/src/ios/CDVSplashScreen.m @@ -163,7 +163,7 @@ - (void)updateBounds { UIImage* img = _imageView.image; - CGRect imgBounds = CGRectMake(0, 0, img.size.width, img.size.height); + CGRect imgBounds = (img) ? CGRectMake(0, 0, img.size.width, img.size.height) : CGRectZero; CGSize screenSize = [self.viewController.view convertRect:[UIScreen mainScreen].bounds fromView:nil].size; @@ -172,8 +172,8 @@ CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil]; if (!(IsAtLeastiOSVersion(@"7.0"))) { imgBounds.origin.y -= statusFrame.size.height; - } - } else { + } + } else if (imgBounds.size.width > 0) { CGRect viewBounds = self.viewController.view.bounds; CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height; CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
