File tree Expand file tree Collapse file tree
MessageDisplayKit/Classes/Views/MessageContentViews Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,16 +55,24 @@ - (void)configureMessagePhoto:(UIImage *)messagePhoto thumbnailUrl:(NSString *)t
5555 if ([url.absoluteString isEqualToString: thumbnailUrl]) {
5656
5757 if (CGRectEqualToRect (weakSelf.bounds , CGRectZero)) {
58- weakSelf.semaphore = dispatch_semaphore_create (0 );
59- dispatch_semaphore_wait (weakSelf.semaphore , DISPATCH_TIME_FOREVER);
60- weakSelf.semaphore = nil ;
58+ if (weakSelf) {
59+ weakSelf.semaphore = dispatch_semaphore_create (0 );
60+ dispatch_semaphore_wait (weakSelf.semaphore , DISPATCH_TIME_FOREVER);
61+ weakSelf.semaphore = nil ;
62+ }
6163 }
6264
63- image = [ image thumbnailImage: CGRectGetWidth (weakSelf.bounds) * 2 transparentBorder: 0 cornerRadius: 0 interpolationQuality: 1.0 ];
65+ // if image not nil
6466 if (image) {
67+ // scale image
68+ image = [image thumbnailImage: CGRectGetWidth (weakSelf.bounds) * 2 transparentBorder: 0 cornerRadius: 0 interpolationQuality: 1.0 ];
6569 dispatch_async (dispatch_get_main_queue (), ^{
66- weakSelf.messagePhoto = image;
67- [weakSelf.activityIndicatorView stopAnimating ];
70+ // if image not nil
71+ if (image) {
72+ // show image
73+ weakSelf.messagePhoto = image;
74+ [weakSelf.activityIndicatorView stopAnimating ];
75+ }
6876 });
6977 }
7078 }
You can’t perform that action at this time.
0 commit comments