Skip to content
Snippets Groups Projects
Commit ac017cbe authored by Ankit Meel's avatar Ankit Meel Committed by Steve Lhomme
Browse files

macosx: Fix crash in randomItem from empty array

parent 586bf64e
No related branches found
No related tags found
1 merge request!5124macosx: Fix crash in randomItem from empty array
Pipeline #453277 passed with stage
in 31 minutes and 14 seconds
......@@ -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];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment