Skip to content

Commit 3dea962

Browse files
Roman KyrylenkoRoman Kyrylenko
Roman Kyrylenko
authored and
Roman Kyrylenko
committed
fixed findFirst method;
1 parent 51e18ae commit 3dea962

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Source/Core/DBClient.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ public extension DBClient {
9898

9999
let predicate = NSPredicate(format: "\(primaryKey) == %@", primaryValue)
100100
let request = FetchRequest<T>(predicate: predicate, fetchLimit: 1)
101-
if let first = execute(request).result?.first {
102-
return Task(first)
101+
102+
return execute(request).continueWithTask { task -> Task<T?> in
103+
if let first = task.result?.first {
104+
return Task(first)
105+
}
106+
return Task(nil)
103107
}
104-
return Task(nil)
105108
}
106109

107110
/**

0 commit comments

Comments
 (0)