Fixed broken API contract of returned nil value for non-nil behaviour. Now returning empty dictionary instead

This commit is contained in:
Michael Starke
2020-07-01 14:34:29 +02:00
parent 8f4f3f7053
commit 431f9ce22c

View File

@@ -35,7 +35,7 @@ BOOL skipWindowTitle(NSString *windowTitle) {
NSArray *currentWindows = CFBridgingRelease(CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements, kCGNullWindowID)); NSArray *currentWindows = CFBridgingRelease(CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements, kCGNullWindowID));
NSArray *windowNumbers = [NSWindow windowNumbersWithOptions:NSWindowNumberListAllApplications]; NSArray *windowNumbers = [NSWindow windowNumbersWithOptions:NSWindowNumberListAllApplications];
NSUInteger minZIndex = NSNotFound; NSUInteger minZIndex = NSNotFound;
NSDictionary *infoDict = nil; NSDictionary *infoDict = @{};
for(NSDictionary *windowDict in currentWindows) { for(NSDictionary *windowDict in currentWindows) {
NSString *windowTitle = windowDict[(NSString *)kCGWindowName]; NSString *windowTitle = windowDict[(NSString *)kCGWindowName];
/* skip a list of well know useless window-titles */ /* skip a list of well know useless window-titles */