Skip to content

Commit 2736bf7

Browse files
authored
Merge pull request #3661 from wmathurin/dev
Fixing recursive call in isNewerThanServer
2 parents e71cc46 + b89f2d3 commit 2736bf7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

libs/MobileSync/MobileSync/Classes/Target/SFSyncUpTarget.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,22 @@ - (void)isNewerThanServer:(SFMobileSyncSyncManager *)syncManager
162162
result:(NSMutableDictionary*)result
163163
resultBlock:(SFSyncUpRecordsNewerThanServerBlock)resultBlock
164164
{
165-
NSDictionary* record = records[i];
166-
NSNumber* storeId = record[SOUP_ENTRY_ID];
167-
__weak typeof(self) weakSelf = self;
168-
[self isNewerThanServer:syncManager record:record resultBlock:^(BOOL isNewerThanServer) {
169-
__strong typeof(weakSelf) strongSelf = weakSelf;
170-
result[storeId] = [NSNumber numberWithBool:isNewerThanServer];
171-
if (i < records.count-1) {
165+
if (i < records.count) {
166+
NSDictionary* record = records[i];
167+
NSNumber* storeId = record[SOUP_ENTRY_ID];
168+
__weak typeof(self) weakSelf = self;
169+
[self isNewerThanServer:syncManager record:record resultBlock:^(BOOL isNewerThanServer) {
170+
__strong typeof(weakSelf) strongSelf = weakSelf;
171+
result[storeId] = [NSNumber numberWithBool:isNewerThanServer];
172172
[strongSelf isNewerThanServer:syncManager
173173
records:records
174174
index:i+1
175175
result:result
176176
resultBlock:resultBlock];
177-
} else {
178-
resultBlock(result);
179-
}
180-
}];
177+
}];
178+
} else {
179+
resultBlock(result);
180+
}
181181
}
182182

183183

0 commit comments

Comments
 (0)