Skip to content

Commit

Permalink
bugfix: don't try to retain NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
http://jneen.net/ committed Jun 8, 2020
1 parent e538bcb commit 4cbe37d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/display_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ CFStringRef display_manager_arrangement_display_uuid(int arrangement)
int index = arrangement - 1;
if (in_range_ie(index, 0, count)) {
if (g_display_manager.sort_order == DISPLAY_SORT_NONE) {
result = CFArrayGetValueAtIndex(displays, index);
result = CFRetain(CFArrayGetValueAtIndex(displays, index));
} else {
// copy the array to a mutable one, then sort it in place
CFRange all = CFRangeMake((long) 0, (long) count);
CFMutableArrayRef mut_displays = CFArrayCreateMutableCopy(NULL, count, displays);
CFArraySortValues(mut_displays, all, &coordinate_comparator, NULL);
result = CFArrayGetValueAtIndex(mut_displays, index);
result = CFRetain(CFArrayGetValueAtIndex(mut_displays, index));
CFRelease(mut_displays);
}
}

CFRelease(displays);
return CFRetain(result);
return result;
}

uint32_t display_manager_arrangement_display_id(int arrangement)
Expand Down

0 comments on commit 4cbe37d

Please sign in to comment.