Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ddd4ea12 by Claudio Cambra at 2022-09-07T06:41:30+00:00
macosx: Guard against crashing in frameForDisplacedAttributes of 
VLCLibraryCollectionViewFlowLayout

Signed-off-by: Claudio Cambra <[email protected]>

- - - - -


1 changed file:

- modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m
=====================================
@@ -226,13 +226,26 @@ static CVReturn 
detailViewAnimationCallback(CVDisplayLinkRef displayLink,
 # pragma mark - Calculation of displaced frame attributes
 
 - (NSRect)frameForDisplacedAttributes:(NSCollectionViewLayoutAttributes 
*)inAttributes {
+    if(inAttributes == nil || _animationSteps == NULL) {
+        return NSZeroRect;
+    }
+
     NSRect attributesFrame = inAttributes.frame;
+
     if (self.selectedIndexPath) {
-        NSRect selectedItemFrame = [[self 
layoutAttributesForItemAtIndexPath:_selectedIndexPath] frame];
+        NSCollectionViewLayoutAttributes *selectedItemLayoutAttributes = [self 
layoutAttributesForItemAtIndexPath:_selectedIndexPath];
+
+        if(selectedItemLayoutAttributes == nil) {
+            return attributesFrame;
+        }
+
+        NSRect selectedItemFrame = selectedItemLayoutAttributes.frame;
+
         if (NSMinY(attributesFrame) > (NSMaxY(selectedItemFrame))) {
             attributesFrame.origin.y += [_animationSteps[_animationIndex] 
floatValue] + kDetailViewMargin;
         }
     }
+
     return attributesFrame;
 }
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/ddd4ea126b8d2049613e7116a1606f4c4fd62a56

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/ddd4ea126b8d2049613e7116a1606f4c4fd62a56
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to