Skip to content

Commit

Permalink
Merge pull request #28 from WadonLiu/master
Browse files Browse the repository at this point in the history
Update UIImage+LLPrivate.m  iPad上异常的问题
  • Loading branch information
internetWei authored Sep 2, 2024
2 parents 3362773 + ca3f110 commit 2d7d030
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
20 changes: 14 additions & 6 deletions LLDynamicLaunchScreen/LLDynamicLaunchScreen+LLPrivate.m
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,20 @@ + (nullable NSString *)ll_getLaunchImageNameWithC:(UIImage *)targetImage atPaths


+ (nullable UIViewController *)ll_getLaunchScreenViewController {
NSString *launchStoryboardName = [self ll_getAPPInfoForKey:@"UILaunchStoryboardName"];
launchStoryboardName = [launchStoryboardName stringByDeletingPathExtension];
if (launchStoryboardName == nil) { return nil; }

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:launchStoryboardName bundle:nil];
return [storyboard instantiateInitialViewController];
// this class is not key value coding-compliant for the key sceneViewController
//添加异常处理
@try {
NSString *launchStoryboardName = [self ll_getAPPInfoForKey:@"UILaunchStoryboardName"];
launchStoryboardName = [launchStoryboardName stringByDeletingPathExtension];
if (launchStoryboardName == nil) { return nil; }

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:launchStoryboardName bundle:nil];
return [storyboard instantiateInitialViewController];
} @catch (NSException *exception) {
return nil;
} @finally {

}
}


Expand Down
6 changes: 5 additions & 1 deletion LLDynamicLaunchScreen/UIImage+LLPrivate.m
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,11 @@ - (UIColor *)ll_colorAtPoint:(CGPoint)point {
CGContextRelease(context);

NSInteger byteIndex = (bytesPerRow * point.y) + (point.x * bytesPerPixel);

if (byteIndex > height*width*4) {
//ipad上异常
free(rawData);
return [UIColor whiteColor];
}
CGFloat red = (rawData[byteIndex] * 1.f) / 255.f;
CGFloat green = (rawData[byteIndex + 1] * 1.f) / 255.f;
CGFloat blue = (rawData[byteIndex + 2] * 1.f) / 255.f;
Expand Down

0 comments on commit 2d7d030

Please sign in to comment.