From 2ed99ae914206ec7ba7f4a7778c69d6c041a411c Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 3 Aug 2014 20:10:00 +0200 Subject: Replace a few other instances with objectOrNilAtIndex: --- Source/GeneratePreviewForURL.m | 1 + Source/SPColorSelectorView.m | 2 +- Source/SPConnectionController.m | 2 +- Source/SPNavigatorController.m | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) (limited to 'Source') diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index 8aa2bf0a..2e0fc0cb 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -476,6 +476,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, if(!iconImages || [iconImages count] < 1) iconImages = [NSArray arrayWithObject:[NSImage imageNamed:NSImageNameStopProgressTemplate]]; +#warning Shouldn't that be "> 1"? if([iconImages count] > 0) iconImage = [iconImages objectAtIndex:1]; else diff --git a/Source/SPColorSelectorView.m b/Source/SPColorSelectorView.m index 20a894dd..15b18596 100644 --- a/Source/SPColorSelectorView.m +++ b/Source/SPColorSelectorView.m @@ -253,7 +253,7 @@ enum trackingAreaIDs NSRect colorSquareRect = [self rectForColorViewAtIndex:index]; //make sure the color at index is actually defined - if(index >= 0 && [colorList objectAtIndex:index] == nil) + if(index >= 0 && [colorList objectOrNilAtIndex:index] == nil) continue; //do not draw a selection around the X item diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 12624178..a91f6929 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -741,7 +741,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, { NSArray *nodes = [self selectedFavoriteNodes]; - return ([nodes count]) ? (SPTreeNode *)[nodes objectAtIndex:0] : nil; + return (SPTreeNode *)[nodes objectOrNilAtIndex:0]; } /** diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index e721d16b..1a7e52fd 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -389,7 +389,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [syncButton setState:NSOffState]; // Select the database and table - [doc selectDatabase:[pathArray objectAtIndex:1] item:([pathArray count] > 2)?[pathArray objectAtIndex:2]:nil]; + [doc selectDatabase:[pathArray objectAtIndex:1] item:[pathArray objectOrNilAtIndex:2]]; if(oldState == NSOnState) [self performSelector:@selector(_setSyncButtonOn) withObject:nil afterDelay:0.1]; -- cgit v1.2.3