[vlc-commits] [Git][videolan/vlc][master] macosx: RendererMenuController: fix incorrect index check

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sat Aug 26 18:44:29 UTC 2023



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
7f4dbfc4 by Marvin Scholz at 2023-08-26T18:11:58+00:00
macosx: RendererMenuController: fix incorrect index check

The NSMenu indexOf… methods return -1 and not NSNotFound, so the check
here is insufficient and can lead to crashes due to passing a negative
integer to itemAtIndex.

- - - - -


1 changed file:

- modules/gui/macosx/menus/renderers/VLCRendererMenuController.m


Changes:

=====================================
modules/gui/macosx/menus/renderers/VLCRendererMenuController.m
=====================================
@@ -131,7 +131,7 @@
 - (void)removeRendererItem:(VLCRendererItem *)item
 {
     NSInteger index = [_rendererMenu indexOfItemWithRepresentedObject:item];
-    if (index != NSNotFound) {
+    if (index >= 0) {
         NSMenuItem *menuItem = [_rendererMenu itemAtIndex:index];
         // Don't remove selected item
         if (menuItem != _selectedItem)



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

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