Skip to content

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
hughkli committed Dec 4, 2023
1 parent aa06b6b commit 9b30ee6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions LookinDemo/LookinCustomInfoDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- LookinServer/Core (1.2.4)
- LookinServer/Swift (1.2.4):
- LookinServer/Core (1.2.5)
- LookinServer/Swift (1.2.5):
- LookinServer/Core

DEPENDENCIES:
Expand All @@ -11,8 +11,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
LookinServer: 00c7588043ed8e7ab64ce55b9fb747e51371ad06
LookinServer: 6805292e8d2ff9ddfcfaa9357fc5c1f277c90afd

PODFILE CHECKSUM: 46caada19d34f471f9e44165d96af39e799fd091

COCOAPODS: 1.13.0
COCOAPODS: 1.11.3
9 changes: 7 additions & 2 deletions Src/Main/Server/Category/CALayer+LookinServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ - (UIImage *)lks_groupScreenshotWithLowQuality:(BOOL)lowQuality {
}

CGSize contextSize = self.frame.size;
if (contextSize.width <= 0 || contextSize.height <= 0) {
if (contextSize.width <= 0 || contextSize.height <= 0 || contextSize.width > 20000 || contextSize.height > 20000) {
NSLog(@"LookinServer - Failed to capture screenshot. Invalid context size: %@ x %@", @(contextSize.width), @(contextSize.height));
return nil;
}
UIGraphicsBeginImageContextWithOptions(contextSize, NO, renderScale);
Expand Down Expand Up @@ -122,7 +123,11 @@ - (UIImage *)lks_soloScreenshotWithLowQuality:(BOOL)lowQuality {
}];

CGSize contextSize = self.frame.size;
NSAssert(contextSize.width > 0 && contextSize.height > 0, @"");
if (contextSize.width <= 0 || contextSize.height <= 0 || contextSize.width > 20000 || contextSize.height > 20000) {
NSLog(@"LookinServer - Failed to capture screenshot. Invalid context size: %@ x %@", @(contextSize.width), @(contextSize.height));
return nil;
}

UIGraphicsBeginImageContextWithOptions(contextSize, NO, renderScale);
CGContextRef context = UIGraphicsGetCurrentContext();
if (self.lks_hostView && !self.lks_hostView.lks_isChildrenViewOfTabBar) {
Expand Down

0 comments on commit 9b30ee6

Please sign in to comment.