Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ac017cbe by Ankit Meel at 2024-03-28T06:15:08+00:00
macosx: Fix crash in randomItem from empty array

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryHeroView.m
=====================================
@@ -75,6 +75,9 @@
     VLCLibraryModel * const libraryModel = 
VLCMain.sharedInstance.libraryController.libraryModel;
     NSArray * const videos = libraryModel.listOfVideoMedia;
     const NSInteger videoCount = videos.count;
+    if (videoCount == 0) {
+        return nil;
+    }
     const uint32_t randIdx = arc4random_uniform((uint32_t)(videoCount - 1));
     return [videos objectAtIndex:randIdx];
 }



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

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


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to