aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataStorage.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-03-09 00:00:43 +0100
committerMax <post@wickenrode.com>2015-03-09 00:00:43 +0100
commit784876380b871b6d85978a705e2477e7b7d2d984 (patch)
tree5705e92b0aab9fecdf7d37954f5a0c3e873de1ff /Source/SPDataStorage.m
parentb15c7fb2d407ec8751a2579a7a68bbd8a037ccfe (diff)
downloadsequelpro-784876380b871b6d85978a705e2477e7b7d2d984.tar.gz
sequelpro-784876380b871b6d85978a705e2477e7b7d2d984.tar.bz2
sequelpro-784876380b871b6d85978a705e2477e7b7d2d984.zip
Minimal refactoring
Replaced some (range.location + range.length) with NSMaxRange(range)
Diffstat (limited to 'Source/SPDataStorage.m')
-rw-r--r--Source/SPDataStorage.m6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/SPDataStorage.m b/Source/SPDataStorage.m
index 3db04159..dd5e87a5 100644
--- a/Source/SPDataStorage.m
+++ b/Source/SPDataStorage.m
@@ -357,12 +357,12 @@ static inline NSMutableArray* SPDataStorageGetEditedRow(NSPointerArray* rowStore
{
// Throw an exception if the range is out of bounds
- if (rangeToRemove.location + rangeToRemove.length > SPMySQLResultStoreGetRowCount(dataStorage)) {
- [NSException raise:NSRangeException format:@"Requested storage index (%llu) beyond bounds (%llu)", (unsigned long long)(rangeToRemove.location + rangeToRemove.length), SPMySQLResultStoreGetRowCount(dataStorage)];
+ if (NSMaxRange(rangeToRemove) > SPMySQLResultStoreGetRowCount(dataStorage)) {
+ [NSException raise:NSRangeException format:@"Requested storage index (%llu) beyond bounds (%llu)", (unsigned long long)(NSMaxRange(rangeToRemove)), SPMySQLResultStoreGetRowCount(dataStorage)];
}
// Remove the rows from the edited list and underlying storage
- NSUInteger i = MIN(editedRowCount, rangeToRemove.location + rangeToRemove.length);
+ NSUInteger i = MIN(editedRowCount, NSMaxRange(rangeToRemove));
while (--i >= rangeToRemove.location) {
editedRowCount--;
[editedRows removePointerAtIndex:i];