[vlc-commits] [Git][videolan/vlc][master] macosx: Fix crash in randomItem from empty array

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Mar 28 06:15:19 UTC 2024



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


More information about the vlc-commits mailing list