diff options
author | Max <post@wickenrode.com> | 2014-08-01 01:18:44 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2014-08-01 01:18:44 +0200 |
commit | 2570a91dd1e1d7b88b908db33494baeaa5001e74 (patch) | |
tree | c48635205db38479c7ef05b05c394169317271bc /Source/SPArrayAdditions.h | |
parent | b2e63fad01ca76b9090c1a0adbd999990d817846 (diff) | |
download | sequelpro-2570a91dd1e1d7b88b908db33494baeaa5001e74.tar.gz sequelpro-2570a91dd1e1d7b88b908db33494baeaa5001e74.tar.bz2 sequelpro-2570a91dd1e1d7b88b908db33494baeaa5001e74.zip |
Fix for exception on export (#1968)
This fixes an exception that would happen if three conditions were met:
1) No database was selected or it was empty
2) A custom export filename was set
3) You tried to export the result of a custom query
Diffstat (limited to 'Source/SPArrayAdditions.h')
-rw-r--r-- | Source/SPArrayAdditions.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/SPArrayAdditions.h b/Source/SPArrayAdditions.h index 565e0393..cf3673d5 100644 --- a/Source/SPArrayAdditions.h +++ b/Source/SPArrayAdditions.h @@ -86,4 +86,14 @@ static inline void NSMutableArrayReplaceObject(NSArray *self, CFIndex idx, id an - (NSArray *)subarrayWithIndexes:(NSIndexSet *)indexes; +/** + * Variant of objectAtIndex: that avoids the "index out of bounds" exception by + * just returning nil instead. + * + * @warning This method is NOT thread-safe. + * @param index An index + * @return The object located at index or nil. + */ +- (id)objectOrNilAtIndex:(NSUInteger)index; + @end |