Skip to content
Snippets Groups Projects
Commit b64b9c22 authored by Marvin Scholz's avatar Marvin Scholz Committed by David
Browse files

macosx: fix possible SPMediaKeyTap crash

Adding nil to an NSArray would make it raise an
NSInvalidArgumentException which in turn leads to an abort in
dispatch_once:
  https://github.com/apple-oss-distributions/libdispatch/blob/55c3a68e9ec47f1c1d5bb9909404ce5f0351edef/src/object.m#L557



Fix #27487

(cherry picked from commit 41ec80a1)
Signed-off-by: default avatarMarvin Scholz <epirat07@gmail.com>
parent 8bf90465
No related branches found
No related tags found
Loading
Pipeline #288888 passed with stages
in 20 minutes and 18 seconds
......@@ -157,8 +157,13 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
static NSArray *bundleIdentifiers;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *ourIdentifier = [[NSBundle mainBundle] bundleIdentifier];
if (ourIdentifier == nil) {
NSLog(@"SPMediaKeyTap: Bundle identifier unexpectedly nil, falling back to org.videolan.vlc");
ourIdentifier = @"org.videolan.vlc";
}
bundleIdentifiers = @[
[[NSBundle mainBundle] bundleIdentifier], // your app
ourIdentifier, // your app
@"com.spotify.client",
@"com.apple.iTunes",
@"com.apple.Music",
......
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