Skip to content

Commit 1c6bf76

Browse files
committed
Fix smoothbrain
1 parent 128246f commit 1c6bf76

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

Sources/SQLite/Typed/Coding.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,11 @@ private class SQLiteDecoder: Decoder {
498498
func decodeIfPresent<T>(_ type: T.Type, forKey key: Key) throws -> T? where T: Swift.Decodable {
499499
switch type {
500500
case is Data.Type:
501-
if let data = try? row.get(Expression<Data>(key.stringValue)) {
502-
return data as? T
503-
}
501+
return try? row.get(Expression<Data>(key.stringValue)) as? T
504502
case is Date.Type:
505-
if let date = try? row.get(Expression<Date>(key.stringValue)) {
506-
return date as? T
507-
}
503+
return try? row.get(Expression<Date>(key.stringValue)) as? T
508504
case is UUID.Type:
509-
if let uuid = try? row.get(Expression<UUID>(key.stringValue)) {
510-
return uuid as? T
511-
}
505+
return try? row.get(Expression<UUID>(key.stringValue)) as? T
512506
default:
513507
guard let JSONString = try? row.get(Expression<String?>(key.stringValue)) else {
514508
throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,
@@ -520,8 +514,6 @@ private class SQLiteDecoder: Decoder {
520514
}
521515
return try JSONDecoder().decode(type, from: data)
522516
}
523-
524-
return nil
525517
}
526518

527519
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws

0 commit comments

Comments
 (0)