[vlc-commits] [Git][videolan/vlc][master] macosx: Guard against crashing in frameForDisplacedAttributes of VLCLibraryCollectionViewFlowLayout

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Sep 7 07:51:59 UTC 2022



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 <claudio.cambra at gmail.com>

- - - - -


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


More information about the vlc-commits mailing list