Skip to content

Commit bad16cb

Browse files
Bugfix: returning nil when decoding an optional should not throw an error
1 parent 20ebe9b commit bad16cb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/SQLite/Typed/Coding.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,8 @@ private class SQLiteDecoder: Decoder {
504504
case is UUID.Type:
505505
return try? row.get(Expression<UUID>(key.stringValue)) as? T
506506
default:
507-
guard let JSONString = try? row.get(Expression<String?>(key.stringValue)) else {
508-
throw DecodingError.typeMismatch(type, DecodingError.Context(codingPath: codingPath,
509-
debugDescription: "an unsupported type was found"))
507+
guard let JSONString = try row.get(Expression<String?>(key.stringValue)) else {
508+
return nil
510509
}
511510
guard let data = JSONString.data(using: .utf8) else {
512511
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath,

0 commit comments

Comments
 (0)