[vlc-commits] [Git][videolan/vlc][master] macosx: Fix concurrency/oob crash for album supplementary detail view in audio group data source

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Mar 29 10:10:22 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
644d434d by Claudio Cambra at 2024-03-29T09:37:08+00:00
macosx: Fix concurrency/oob crash for album supplementary detail view in audio group data source

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


1 changed file:

- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m


Changes:

=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m
=====================================
@@ -252,13 +252,14 @@ viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
                atIndexPath:(NSIndexPath *)indexPath
 {
     if ([kind isEqualToString:VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind]) {
-        if (self.representedListOfAlbums == nil || self.representedListOfAlbums.count == 0) {
+        NSArray<VLCMediaLibraryAlbum *> * const albums = self.representedListOfAlbums;
+        if (albums == nil || albums.count == 0 || indexPath.item >= albums.count) {
             return nil;
         }
 
         VLCLibraryCollectionViewAlbumSupplementaryDetailView* albumSupplementaryDetailView = [collectionView makeSupplementaryViewOfKind:kind withIdentifier:VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind forIndexPath:indexPath];
 
-        VLCMediaLibraryAlbum * const album = self.representedListOfAlbums[indexPath.item];
+        VLCMediaLibraryAlbum * const album = albums[indexPath.item];
         VLCLibraryRepresentedItem * const representedItem = [[VLCLibraryRepresentedItem alloc] initWithItem:album parentType:_currentParentType];
 
         albumSupplementaryDetailView.representedItem = representedItem;



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/644d434de095fa5c5537b7a88d3a80e9b851b02b
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